[−][src]Struct sbf::data_structure::SBF
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]
U: 'static + Send + Sync + Clone + Copy + Ord + PartialOrd + Eq + Unsigned + Bounded + Zero + FromPrimitive + ToPrimitive + AddAssign + SubAssign,
usize: AsPrimitive<U>,
pub fn new(
cells: U,
hash_number: usize,
max_input_size: usize,
hash_function: HashFunction,
area_number: U
) -> Result<Self, Error>
[src]
cells: U,
hash_number: usize,
max_input_size: usize,
hash_function: HashFunction,
area_number: U
) -> Result<Self, Error>
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]
expected_inserts: usize,
area_number: U,
max_fpp: f64,
max_input_size: usize,
hash_function: HashFunction
) -> Result<Self, Error>
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]
U: Unsigned + Bounded + Clone + Copy + PartialOrd + Eq,
impl<U: Debug> Debug for SBF<U> where
U: Unsigned + Bounded + Clone + Copy + PartialOrd + Eq,
[src]
U: Unsigned + Bounded + Clone + Copy + PartialOrd + Eq,
Auto Trait Implementations
impl<U> RefUnwindSafe for SBF<U> where
U: RefUnwindSafe,
U: RefUnwindSafe,
impl<U> Send for SBF<U> where
U: Send,
U: Send,
impl<U> Sync for SBF<U> where
U: Sync,
U: Sync,
impl<U> Unpin for SBF<U> where
U: Unpin,
U: Unpin,
impl<U> UnwindSafe for SBF<U> where
U: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,