Struct ethcore_bloom_journal::Bloom
source · [−]pub struct Bloom { /* private fields */ }
Expand description
Bloom filter structure
Implementations
sourceimpl Bloom
impl Bloom
sourcepub fn new(bitmap_size: usize, items_count: usize) -> Bloom
pub fn new(bitmap_size: usize, items_count: usize) -> Bloom
Create a new bloom filter structure. bitmap_size is the size in bytes (not bits) that will be allocated in memory items_count is an estimation of the maximum number of items to store.
sourcepub fn from_parts(parts: &[u64], k_num: u32) -> Bloom
pub fn from_parts(parts: &[u64], k_num: u32) -> Bloom
Initializes bloom filter from saved state
sourcepub fn new_for_fp_rate(items_count: usize, fp_p: f64) -> Bloom
pub fn new_for_fp_rate(items_count: usize, fp_p: f64) -> Bloom
Create a new bloom filter structure. items_count is an estimation of the maximum number of items to store. fp_p is the wanted rate of false positives, in ]0.0, 1.0[
sourcepub fn compute_bitmap_size(items_count: usize, fp_p: f64) -> usize
pub fn compute_bitmap_size(items_count: usize, fp_p: f64) -> usize
Compute a recommended bitmap size for items_count items and a fp_p rate of false positives. fp_p obviously has to be within the ]0.0, 1.0[ range.
sourcepub fn check<T>(&self, item: T) -> bool where
T: Hash,
pub fn check<T>(&self, item: T) -> bool where
T: Hash,
Check if an item is present in the set. There can be false positives, but no false negatives.
sourcepub fn number_of_bits(&self) -> u64
pub fn number_of_bits(&self) -> u64
Return the number of bits in the filter
sourcepub fn number_of_hash_functions(&self) -> u32
pub fn number_of_hash_functions(&self) -> u32
Return the number of hash functions used for check
and set
sourcepub fn drain_journal(&mut self) -> BloomJournal
pub fn drain_journal(&mut self) -> BloomJournal
Drains the bloom journal returning the updated bloom part
sourcepub fn saturation(&self) -> f64
pub fn saturation(&self) -> f64
Returns the ratio of set bits in the bloom filter to the total bits
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more