[−][src]Struct qht::QQuotientHashTableD
QQuotient Hash Table Duplicates ("compact")
This implements qqhtdc, using a dense bitset as the underlying data structure
Methods
impl QQuotientHashTableD
[src]
pub fn new(
memory_size: usize,
n_buckets: usize,
fingerprint_size: usize
) -> Self
[src]
memory_size: usize,
n_buckets: usize,
fingerprint_size: usize
) -> Self
Returns a a newly created QQuotientHashTableD
or panics
This function takes as arguments:
memory_size
: allocated memory for the filter, in bitsn_buckets
: number of bucketsfingerprint_size
: size of each fingerprint, in bits. Cannot exceedFINGERPRINT_SIZE_LIMIT
.
Parameters should be chosen in a consistent way, namely so that memory_size
>= n_buckets
* fingerprint_size
Example
use qht::{QQuotientHashTableD,BasicQHT}; let f = QQuotientHashTableD::new(1024, 1, 3);
Trait Implementations
impl Filter for QQuotientHashTableD
[src]
fn lookup(&self, e: impl Hash) -> bool
[src]
Performs a lookup for the provided element
Example
use qht::{Element, Filter, QQuotientHashTableD, BasicQHT}; let f = QQuotientHashTableD::new(1024, 1, 3); let e = Element { value: 1234 }; assert!( !f.lookup(e) ); // The filter is empty
fn insert(&mut self, e: impl Hash) -> bool
[src]
Performs a lookup for an element and inserts it
Note: In this implementation, if the element is already present, it is re-inserted.
Note: The new element is inserted in the last bucket (not a random bucket)
Example
use qht::{Element,Filter, QQuotientHashTableD, BasicQHT}; let mut f = QQuotientHashTableD::new(1024, 1, 3); let e = Element { value: 1234 }; let was_present = f.insert(e); assert!( f.lookup(e) ); // The filter now contains e assert!( !was_present ); // The filter did not previously contain e
impl BasicQHT for QQuotientHashTableD
[src]
fn get_fingerprint_from_bucket(
&self,
address: usize,
bucket_number: usize
) -> u64
[src]
&self,
address: usize,
bucket_number: usize
) -> u64
Retrieves a fingerprint from a given bucket (provided as an address
and bucket_number
)
fn insert_fingerprint_in_bucket(
&mut self,
address: usize,
bucket_number: usize,
fingerprint: u64
)
[src]
&mut self,
address: usize,
bucket_number: usize,
fingerprint: u64
)
Inserts a fingerprint in a given buffer (provided as an address
and bucket_number
)
fn in_cell(&self, address: usize, fingerprint: u64) -> bool
[src]
Checks whether a fingerprint belongs to a given cell
fn get_fingerprint(&self, e: impl Hash) -> u64
[src]
Obtains an element's fingerprint
Auto Trait Implementations
impl Send for QQuotientHashTableD
impl Sync for QQuotientHashTableD
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,