pub struct CMap<C, S = BuildDefaultSeededHasher> { /* private fields */ }
Expand description
Finger-printing based compressed static function (immutable map) that maps hashable keys to values of any type.
To represent a function f:X→Y, it uses the space slightly larger than |X|H, where H is the entropy of the distribution of the f values over X. The expected time complexity is O(c) for evaluation and O(|X|c) for construction (not counting building the encoding dictionary), where c is the average codeword length (given in code fragments) of the values.
Implementations§
source§impl<C: Coding, S: BuildSeededHasher> CMap<C, S>
impl<C: Coding, S: BuildSeededHasher> CMap<C, S>
source§impl<C: SerializableCoding, S: BuildSeededHasher> CMap<C, S>
impl<C: SerializableCoding, S: BuildSeededHasher> CMap<C, S>
sourcepub fn write_bytes(&self, bytes_per_value: usize) -> usize
pub fn write_bytes(&self, bytes_per_value: usize) -> usize
Returns number of bytes which write
will write, assuming that each call to write_value
writes bytes_per_value
bytes.
source§impl<C: SerializableCoding> CMap<C>
impl<C: SerializableCoding> CMap<C>
source§impl<C: Coding, S: BuildSeededHasher> CMap<C, S>
impl<C: Coding, S: BuildSeededHasher> CMap<C, S>
pub fn from_slices_with_coding_conf<K, LSC, CSB, BS, BC>(
keys: &mut [K],
values: &[C::Value],
value_coding: C,
conf: CMapConf<BC, LSC, CSB, S>,
stats: &mut BS
) -> Selfwhere
K: Hash,
LSC: LevelSizeChooser,
CSB: CollisionSolverBuilder + IsLossless,
BS: BuildStatsCollector,
pub fn from_slices_with_conf<K, LSC, CSB, BS, BC>(
keys: &mut [K],
values: &[C::Value],
conf: CMapConf<BC, LSC, CSB, S>,
stats: &mut BS
) -> Selfwhere
K: Hash,
LSC: LevelSizeChooser,
CSB: CollisionSolverBuilder + IsLossless,
BS: BuildStatsCollector,
BC: BuildCoding<C::Value, Coding = C>,
pub fn from_map_with_coding_conf<K, H, LSC, CSB, BS, BC>(
map: &HashMap<K, C::Value, H>,
value_coding: C,
conf: CMapConf<BC, LSC, CSB, S>,
stats: &mut BS
) -> Selfwhere
K: Hash + Clone,
LSC: LevelSizeChooser,
CSB: CollisionSolverBuilder + IsLossless,
BS: BuildStatsCollector,
pub fn from_map_with_conf<K, H, LSC, CSB, BS, BC>(
map: &HashMap<K, C::Value, H>,
conf: CMapConf<BC, LSC, CSB, S>,
stats: &mut BS
) -> Selfwhere
K: Hash + Clone,
LSC: LevelSizeChooser,
CSB: CollisionSolverBuilder + IsLossless,
BS: BuildStatsCollector,
BC: BuildCoding<C::Value, Coding = C>,
Trait Implementations§
source§impl<C: GetSize, S> GetSize for CMap<C, S>
impl<C: GetSize, S> GetSize for CMap<C, S>
source§fn size_bytes_dyn(&self) -> usize
fn size_bytes_dyn(&self) -> usize
Returns approximate number of bytes occupied by dynamic (heap) part of
self
.
Same as self.size_bytes() - std::mem::size_of_val(self)
.source§const USES_DYN_MEM: bool = true
const USES_DYN_MEM: bool = true
true
if and only if the variables of this type can use dynamic (heap) memory.source§fn size_bytes_content_dyn(&self) -> usize
fn size_bytes_content_dyn(&self) -> usize
Returns approximate number of bytes occupied by dynamic (heap) part of
self
content.
It usually equals to size_bytes_dyn()
.
However, sometimes it is smaller by the amount of memory reserved but not yet used
(e.g., size_bytes_content_dyn()
only takes into account the length of the vector and not its capacity).source§fn size_bytes(&self) -> usize
fn size_bytes(&self) -> usize
Returns approximate, total (including heap memory) number of bytes occupied by
self
.Auto Trait Implementations§
impl<C, S> RefUnwindSafe for CMap<C, S>where
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<C, S> Send for CMap<C, S>
impl<C, S> Sync for CMap<C, S>
impl<C, S> Unpin for CMap<C, S>
impl<C, S> UnwindSafe for CMap<C, S>where
C: UnwindSafe,
S: UnwindSafe,
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