Struct Bloom

Source
pub struct Bloom { /* private fields */ }

Implementations§

Source§

impl Bloom

Source

pub fn new(num_entries: f64, wrongs: f64) -> Self

returns a new bloom filter.

Source

pub fn add(&mut self, hash: u64)

<— http://www.cse.yorku.ca/~oz/hash.html modified Berkeley DB Hash (32bit) hash is casted to l, h = 16bit fragments func (bl Bloom) absdbm(b *[]byte) (l, h uint64) { hash := uint64(len(*b)) for _, c := range *b { hash = uint64(c) + (hash << 6) + (hash << bl.sizeExp) - hash } h = hash >> bl.shift l = hash << bl.shift >> bl.shift return l, h }

Source

pub fn add_if_not_has(&mut self, hash: u64) -> bool

AddIfNotHas only Adds hash, if it’s not present in the bloomfilter. Returns true if hash was added. Returns false if hash was already registered in the bloomfilter.

Source

pub fn clear(&mut self)

Clear resets the Bloom filter.

Source

pub fn set(&mut self, idx: u64)

Set sets the bit[idx] of bitset.

Source

pub fn size(&mut self, sz: u64)

Size makes Bloom filter with as bitset of size sz.

Source

pub fn has(&mut self, hash: u64) -> bool

Has checks if bit(s) for entry hash is/are set, returns true if the hash was added to the Bloom Filter.

Source

pub fn isset(&mut self, idx: u64) -> bool

IsSet checks if bit[idx] of bitset is set, returns true/false.

Auto Trait Implementations§

§

impl Freeze for Bloom

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V