Trait mkit::db::Bloom[][src]

pub trait Bloom: Sized + Default {
    type Err: Display;
    fn add_key<Q: ?Sized + Hash>(&mut self, key: &Q);
fn add_digest32(&mut self, digest: u32);
fn build(&mut self);
fn contains<Q: ?Sized + Hash>(&self, element: &Q) -> bool;
fn to_bytes(&self) -> Result<Vec<u8>, Self::Err>;
fn from_bytes(buf: &[u8]) -> Result<(Self, usize), Self::Err>;
fn or(&self, other: &Self) -> Result<Self, Self::Err>; }

Trait to build and manage keys in a bit-mapped Bloom-filter.

Associated Types

Loading content...

Required methods

fn add_key<Q: ?Sized + Hash>(&mut self, key: &Q)[src]

Add key into the index.

fn add_digest32(&mut self, digest: u32)[src]

Add key into the index.

fn build(&mut self)[src]

Build keys, added so far via add_key and add_digest32 into the bitmap index. Useful for types that support batch building and immutable bitmap index.

fn contains<Q: ?Sized + Hash>(&self, element: &Q) -> bool[src]

Check whether key in present, there can be false positives but no false negatives.

fn to_bytes(&self) -> Result<Vec<u8>, Self::Err>[src]

Serialize the bit-map to binary array.

fn from_bytes(buf: &[u8]) -> Result<(Self, usize), Self::Err>[src]

Deserialize the binary array to bit-map.

fn or(&self, other: &Self) -> Result<Self, Self::Err>[src]

Merge two bitmaps.

Loading content...

Implementations on Foreign Types

impl<H> Bloom for Xor8<H> where
    H: Default + BuildHasher + From<Vec<u8>> + Into<Vec<u8>> + Clone
[src]

type Err = Error

Loading content...

Implementors

impl Bloom for NoBitmap[src]

type Err = Infallible

fn from_bytes(_buf: &[u8]) -> Result<(Self, usize), Self::Err>[src]

Deserialize the binary array to bit-map.

fn or(&self, _other: &Self) -> Result<Self, Self::Err>[src]

Merge two bitmaps.

Loading content...