QuotientFilter

Struct QuotientFilter 

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

Implementations§

Source§

impl QuotientFilter

Source

pub fn new(quotient_size: u8) -> Result<Self>

Creates a new filter. Quotient size defines the size, ex. quotient_size = 2, size of table is 2^2 = 4 And 64 - 2 = 62 rest of the bits will be used for remainder

Source

pub fn insert_value(&mut self, value: &[u8]) -> Result<usize>

Inserts byte-value using fnv1a

Source

pub fn lookup_value(&mut self, value: &[u8]) -> bool

Reads byte-value using fnv1a

Source

pub fn delete_value(&mut self, value: &[u8])

Deleted byte-value using fnv1a

Source

pub fn space(&self) -> u64

How much space are we spending

Source

pub fn resize(&mut self) -> Result<()>

Doubles the size of the table

Source

pub fn merge(&mut self, other: &QuotientFilter) -> Result<()>

Merges a second filter into original one and doubles its original size. They have to have the same size.

Source

pub fn lookup(&mut self, fingerprint: u64) -> bool

Returns if the element exists, by using custom fingerprint

Source

pub fn delete(&mut self, fingerprint: u64)

Source

pub fn insert(&mut self, fingerprint: u64) -> Result<usize>

Inserts the element by using custom fingerprint and returns the index

Source

pub fn get_index(&self, fingerprint: u64) -> Option<usize>

Auto Trait Implementations§

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.