Skip to content

Commit d28ccb9

Browse files
committed
add init data
1 parent 277899f commit d28ccb9

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["algorithm-macro"]
33

44
[package]
55
name = "algorithm"
6-
version = "0.1.9"
6+
version = "0.1.10"
77
edition = "2021"
88
authors = ["tickbh <[email protected]>"]
99
description = "about algorithm data structure, now has ttl with lru/lru-k/lfu/arc and slab/rbtree/roaring_bitmap/timer_wheelss, 关于算法常用的数据结构"

src/buf/binary_mut.rs

+7
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,13 @@ impl BinaryMut {
289289
}
290290
}
291291

292+
pub fn data_mut(&mut self) -> &mut [u8] {
293+
if self.wpos + 128 < self.vec.capacity() {
294+
self.reserve(128);
295+
}
296+
&mut self.vec[self.wpos..]
297+
}
298+
292299
#[inline]
293300
pub unsafe fn try_resort_memory(&mut self) {
294301
if self.vec.len() < self.resort || self.cursor < self.resort / 2 {

0 commit comments

Comments
 (0)