pub struct CuckooConfiguration { /* private fields */ }Expand description
Configuration for the crate::CuckooFilter.
Used to define main cuckoo filter parameters (capacity, bucket size, fingeprint size, max kicks), as well as additional features (TTL, LRU, generic counter).
Create a new instance using CuckooConfiguration::builder.
§Examples
use cuckoo_clock::config::CuckooConfiguration;
let config = CuckooConfiguration::builder(100_000)
.fingerprint_bits(14.try_into()?)
.bucket_size(4.try_into()?)
.max_kicks(8)
.build()?;use cuckoo_clock::config::{CuckooConfiguration, TtlConfig, LruConfig};
let config = CuckooConfiguration::builder(100_000)
.fingerprint_bits(14.try_into()?)
.with_ttl(TtlConfig {
ttl: 10.try_into()?,
ttl_bits: 4.try_into()?
})
.with_lru(LruConfig {
counter_bits: 6.try_into()?,
..Default::default()
})
.bucket_size(4.try_into()?)
.max_kicks(8)
.build()?;Implementations§
Source§impl CuckooConfiguration
impl CuckooConfiguration
Sourcepub const fn builder(max_entries: usize) -> CuckooConfigurationBuilder
pub const fn builder(max_entries: usize) -> CuckooConfigurationBuilder
Creates a new instance of CuckooConfigurationBuilder with provided maximum number of
entries.
Sourcepub const fn get_configured_memory_usage(&self) -> usize
pub const fn get_configured_memory_usage(&self) -> usize
Returns the memory usage of filter that would be created from this configuration in bytes.
Sourcepub fn compatible_layout(&self, other: Self) -> bool
pub fn compatible_layout(&self, other: Self) -> bool
Checks whether this and other configuration have a compatible layout.
If this is true, filter exported by the other configuration can be imported and used with this configuration. The only compatible configuration changes are generally ones that don’t affect size or count of the buckets and items.
Trait Implementations§
Source§impl Clone for CuckooConfiguration
impl Clone for CuckooConfiguration
Source§fn clone(&self) -> CuckooConfiguration
fn clone(&self) -> CuckooConfiguration
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CuckooConfiguration
impl Debug for CuckooConfiguration
impl Eq for CuckooConfiguration
Source§impl PartialEq for CuckooConfiguration
impl PartialEq for CuckooConfiguration
Source§fn eq(&self, other: &CuckooConfiguration) -> bool
fn eq(&self, other: &CuckooConfiguration) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CuckooConfiguration
Auto Trait Implementations§
impl Freeze for CuckooConfiguration
impl RefUnwindSafe for CuckooConfiguration
impl Send for CuckooConfiguration
impl Sync for CuckooConfiguration
impl Unpin for CuckooConfiguration
impl UnsafeUnpin for CuckooConfiguration
impl UnwindSafe for CuckooConfiguration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more