[][src]Struct sbf::data_structure::SBF

pub struct SBF<U> where
    U: Unsigned + Bounded + Clone + Copy + PartialOrd + Eq
{ /* fields omitted */ }

Spatial Bloom Filter data structure

This data structure uses a multi level bloom filter to identify if a content has already been inserted in the filter and of which of a finite number of disjoint subsets of the origin space it belongs to. This is a probabilistic data structure

Implementations

impl<U> SBF<U> where
    U: 'static + Send + Sync + Clone + Copy + Ord + PartialOrd + Eq + Unsigned + Bounded + Zero + FromPrimitive + ToPrimitive + AddAssign + SubAssign,
    usize: AsPrimitive<U>, 
[src]

pub fn new(
    cells: U,
    hash_number: usize,
    max_input_size: usize,
    hash_function: HashFunction,
    area_number: U
) -> Result<Self, Error>
[src]

Constructor of the SBF data structure

  • cells: Number of cells in the filter,
  • hash_number: Number of hash functions used,
  • max_input_size: Maximum input dimension, if a larger one is used it will be truncated,
  • hash_function: Kind of hash function to use,
  • area_number: Number of different areas (only used in metrics).

pub fn new_optimal(
    expected_inserts: usize,
    area_number: U,
    max_fpp: f64,
    max_input_size: usize,
    hash_function: HashFunction
) -> Result<Self, Error>
[src]

Constructor of the SBF data structure using optimal parameters

pub fn check(&self, content: Vec<u8>) -> Result<&U, Error>[src]

Check an input for presence in the filter. It will return 0 if the input is not been inserted or the index of the area it belongs to if it has been inserted previously.

Because of the probabilistic nature of this data structure, it is possible for it to return a false positive.

pub fn insert(&mut self, content: Vec<u8>, area: U) -> Result<(), Error>[src]

Insert the content in the filter associated to the given area.

Trait Implementations

impl<U: Clone> Clone for SBF<U> where
    U: Unsigned + Bounded + Clone + Copy + PartialOrd + Eq
[src]

impl<U: Debug> Debug for SBF<U> where
    U: Unsigned + Bounded + Clone + Copy + PartialOrd + Eq
[src]

Auto Trait Implementations

impl<U> RefUnwindSafe for SBF<U> where
    U: RefUnwindSafe

impl<U> Send for SBF<U> where
    U: Send

impl<U> Sync for SBF<U> where
    U: Sync

impl<U> Unpin for SBF<U> where
    U: Unpin

impl<U> UnwindSafe for SBF<U> where
    U: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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