pub struct Bloom { /* private fields */ }
Expand description
Bloom filter
Implementations§
source§impl Bloom
impl Bloom
sourcepub fn checked_add_assign(&mut self, other: &Bloom) -> bool
pub fn checked_add_assign(&mut self, other: &Bloom) -> bool
Merge filters
sourcepub fn is_offloaded(&self) -> bool
pub fn is_offloaded(&self) -> bool
Check if filter offloaded
sourcepub fn offload_from_memory(&mut self) -> usize
pub fn offload_from_memory(&mut self) -> usize
Clear in-memory filter buffer
sourcepub fn contains_in_memory(&self, item: impl AsRef<[u8]>) -> Option<FilterResult>
pub fn contains_in_memory(&self, item: impl AsRef<[u8]>) -> Option<FilterResult>
Check filter in-memory (if not offloaded)
sourcepub async fn contains_in_file<P: BloomDataProvider>(
&self,
provider: &P,
item: impl AsRef<[u8]>
) -> Result<FilterResult>
pub async fn contains_in_file<P: BloomDataProvider>( &self, provider: &P, item: impl AsRef<[u8]> ) -> Result<FilterResult>
Check filter by reading bits from file
sourcepub fn memory_allocated(&self) -> usize
pub fn memory_allocated(&self) -> usize
Get amount of memory allocated for filter
Trait Implementations§
source§impl<K> FilterTrait<K> for Bloom
impl<K> FilterTrait<K> for Bloom
source§fn contains_fast(&self, key: &K) -> FilterResult
fn contains_fast(&self, key: &K) -> FilterResult
Check if key in filter (should be implemented if filter can be checked without waiting)
source§fn contains<'life0, 'life1, 'life2, 'async_trait, P>(
&'life0 self,
provider: &'life1 P,
key: &'life2 K
) -> Pin<Box<dyn Future<Output = FilterResult> + Send + 'async_trait>>where
P: 'async_trait + BloomDataProvider,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn contains<'life0, 'life1, 'life2, 'async_trait, P>(
&'life0 self,
provider: &'life1 P,
key: &'life2 K
) -> Pin<Box<dyn Future<Output = FilterResult> + Send + 'async_trait>>where
P: 'async_trait + BloomDataProvider,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check if key in filter (can take some time)
source§fn offload_filter(&mut self) -> usize
fn offload_filter(&mut self) -> usize
Offload filter from memory if possible
source§fn checked_add_assign(&mut self, other: &Self) -> bool
fn checked_add_assign(&mut self, other: &Self) -> bool
Add another filter to this filter
source§fn memory_allocated(&self) -> usize
fn memory_allocated(&self) -> usize
Memory used by filter
source§fn clear_filter(&mut self)
fn clear_filter(&mut self)
Clear all filter data
source§fn is_filter_offloaded(&self) -> bool
fn is_filter_offloaded(&self) -> bool
Check if filter was offloaded
Auto Trait Implementations§
impl RefUnwindSafe for Bloom
impl Send for Bloom
impl Sync for Bloom
impl Unpin for Bloom
impl UnwindSafe for Bloom
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