pub struct FilterFn { /* private fields */ }
Expand description
This struct gives an interface to filter methods
Implementations§
Source§impl FilterFn
impl FilterFn
Sourcepub fn new() -> Self
pub fn new() -> Self
Loads a cpu specific optimized implementation of a split block bloom filter. Doesn’t allocate any memory.
Sourcepub unsafe fn contains(
&self,
buf: *const u8,
num_buckets: usize,
hash: u64,
) -> bool
pub unsafe fn contains( &self, buf: *const u8, num_buckets: usize, hash: u64, ) -> bool
Check if filter bits in buf
contain hash
.
§Safety
Caller should make sure the buffer is aligned to ALIGNMENT bytes.
The buffer should have a size of at least num_buckets
* BUCKET_SIZE.
num_buckets
has to be bigger than zero.
Sourcepub unsafe fn insert(&self, buf: *mut u8, num_buckets: usize, hash: u64) -> bool
pub unsafe fn insert(&self, buf: *mut u8, num_buckets: usize, hash: u64) -> bool
Insert hash
into the filter bits inside buf
.
Returns true if hash
was already in the filter bits inside buf
.
§Safety
Caller should make sure the buffer is aligned to ALIGNMENT bytes.
The buffer should have a size of at least num_buckets
* BUCKET_SIZE.
num_buckets
has to be bigger than zero.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FilterFn
impl !RefUnwindSafe for FilterFn
impl !Send for FilterFn
impl !Sync for FilterFn
impl Unpin for FilterFn
impl !UnwindSafe for FilterFn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more