[−][src]Struct xorf::Fuse16
Xor filter using 8-bit fingerprints in a fuse graph. Requires less space than an Xor16
.
A Fuse16
filter uses <18.202 bits per entry of the set is it constructed from, and has a false
positive rate of <0.02%. As with other probabilistic filters, a higher number of entries decreases
the bits per entry but increases the false positive rate.
A Fuse16
filter uses less space and is faster to construct than an Xor16
filter, but
requires a large number of keys to be constructed. Experimentally, this number is somewhere
>100_000. For smaller key sets, prefer the Xor16
filter. A Fuse16
filter may fail to be
constructed.
A Fuse16
is constructed from a set of 64-bit unsigned integers and is immutable.
use xorf::{Filter, Fuse16}; use core::convert::TryFrom; const SAMPLE_SIZE: usize = 1_000_000; let keys: Vec<u64> = (0..SAMPLE_SIZE).map(|_| rng.gen()).collect(); let filter = Fuse16::try_from(&keys).unwrap(); // no false negatives for key in keys { assert!(filter.contains(&key)); } // bits per entry let bpe = (filter.len() as f64) * 8.0 / (SAMPLE_SIZE as f64); assert!(bpe < 18.202, "Bits per entry is {}", bpe); // false positive rate let false_positives: usize = (0..SAMPLE_SIZE) .map(|_| rng.gen()) .filter(|n| filter.contains(n)) .count(); let fp_rate: f64 = (false_positives * 100) as f64 / SAMPLE_SIZE as f64; assert!(fp_rate < 0.02, "False positive rate is {}", fp_rate);
Serializing and deserializing Fuse16
filters can be enabled with the serde
feature.
Trait Implementations
impl Debug for Fuse16
[src]
impl Filter<u64> for Fuse16
[src]
fn contains(&self, key: &u64) -> bool
[src]
Returns true
if the filter contains the specified key. Has a false positive rate of <0.02%.
fn len(&self) -> usize
[src]
impl<'_> TryFrom<&'_ [u64]> for Fuse16
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(keys: &[u64]) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Vec<u64>> for Fuse16
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(v: &Vec<u64>) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<u64>> for Fuse16
[src]
Auto Trait Implementations
impl RefUnwindSafe for Fuse16
impl Send for Fuse16
impl Sync for Fuse16
impl Unpin for Fuse16
impl UnwindSafe for Fuse16
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, 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>,