Skip to content

Commit 6951c0a

Browse files
committed
add clone for binarymut
1 parent 3259c8f commit 6951c0a

File tree

4 files changed

+42
-63
lines changed

4 files changed

+42
-63
lines changed

Cargo.lock

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

Cargo.toml

+8-8
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.16"
6+
version = "0.1.17"
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, 关于算法常用的数据结构"
@@ -14,17 +14,17 @@ keywords = ["arc", "lru", "lfu", "timerwheel", "slab"]
1414
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1515

1616
[dependencies]
17-
lazy_static="1.5.0"
18-
hashbrown="0.14.5"
19-
log="0.4.22"
17+
lazy_static = "1.5.0"
18+
hashbrown = "0.15.2"
19+
log = "0.4.25"
2020

2121
[dependencies.algorithm-macro]
2222
# path = "algorithm-macro"
2323
version = "0.1"
2424

2525
[dev-dependencies]
26-
rand="0.8.5"
27-
libc="0.2.162"
26+
rand = "0.8.5"
27+
libc = "0.2.169"
2828
slab = "0.4.9"
2929

3030
[profile.release]
@@ -33,5 +33,5 @@ debug = true
3333

3434
[features]
3535
default = ["hashbrown", "ttl"]
36-
hashbrown=[]
37-
ttl=[]
36+
hashbrown = []
37+
ttl = []

src/buf/binary_mut.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ pub struct BinaryMut {
4040
resort: usize,
4141
}
4242

43+
impl Clone for BinaryMut {
44+
fn clone(&self) -> Self {
45+
Self {
46+
vec: self.vec.clone(),
47+
cursor: self.cursor.clone(),
48+
wpos: self.wpos.clone(),
49+
mark: self.mark.clone(),
50+
resort: self.resort.clone(),
51+
}
52+
}
53+
}
54+
4355
impl BinaryMut {
4456
#[inline]
4557
pub fn with_capacity(n: usize) -> BinaryMut {
@@ -396,8 +408,6 @@ unsafe impl BtMut for BinaryMut {
396408
}
397409
}
398410

399-
400-
401411
impl AsRef<[u8]> for BinaryMut {
402412
#[inline]
403413
fn as_ref(&self) -> &[u8] {

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ pub use hashbrown::{HashMap, HashSet};
2727
pub use std::collections::{HashMap, HashSet};
2828

2929
#[cfg(feature = "hashbrown")]
30-
pub type DefaultHasher = hashbrown::hash_map::DefaultHashBuilder;
30+
pub type DefaultHasher = hashbrown::DefaultHashBuilder;
3131
#[cfg(not(feature = "hashbrown"))]
3232
pub type DefaultHasher = std::collections::hash_map::RandomState;

0 commit comments

Comments
 (0)