-
Notifications
You must be signed in to change notification settings - Fork 53
[bitvec] change from bit-vec to bitvec #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Got the following warning: warning: manifest at [...] contains `[project]` instead of `[package]`, this could become a hard error in the future This fixes it.
@@ -1,4 +1,4 @@ | |||
[project] | |||
[package] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cargo complains about this...
} | ||
|
||
/// Bloom filter structure | ||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
#[cfg_attr(feature = "serde", serde(crate = "serde"))] | ||
#[derive(Clone, Debug)] | ||
pub struct Bloom<T: ?Sized> { | ||
bit_vec: BitVec, | ||
bit_vec: BitVec<u8>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default it's usize
but to keep compatibility with your api, had to use u8
siphasher = "0.3.7" | ||
bitvec = "1.0.1" | ||
getrandom = { version = "0.2.8", optional = true } | ||
siphasher = "0.3.10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the last version, thought it was OK to bump it. Works well.
@@ -234,7 +235,7 @@ impl<T: ?Sized> Bloom<T> { | |||
|
|||
/// Clear all of the bits in the filter, removing all keys from the set | |||
pub fn clear(&mut self) { | |||
self.bit_vec.clear() | |||
self.bit_vec.fill(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you call clear()
it works but... d58902a then you have to check whether it's defined or not, later.
+1. (see also #42) |
I have rebased this branch onto the latest |
No activity here, lack of traction maybe... Closing. |
This is basically a dependency change, going from https://crates.io/crates/bit-vec to https://crates.io/crates/bitvec
The change was quite straightforward, a few things still:
Vec<u8>
I had to useBitVec<u8>
instead of the defaultBitVec
which is aBitVec<usize>
. I did not investigate to see if that would speed up things, but maybe it does.clear()
function seems to have different semantics in both libraries, looks like the one in the new library clears the data but keeps the capacity. I fail to see how that is practically possible on bits but it looks like it works anyway.Happy to have your feedback on this, I was about to re-implement some Bloom filter with this bitvec, and found adapting your concise (and great!) library was really good enough.