pub struct Map<S = BuildDefaultSeededHasher> { /* private fields */ }
Expand description
Finger-printing based static function (immutable map) that maps hashable keys to unsigned integer values of given bit-size.
It usually takes somewhat more than nb bits to represent a function from an n-element set into a set of b-bit values. (Smaller sizes are achieved when the set of values is small and the same values are assigned to multiple keys.) The expected time complexities of its construction and evaluation are O(n) and O(1), respectively.
Implementations§
source§impl<S: BuildSeededHasher> Map<S>
impl<S: BuildSeededHasher> Map<S>
sourcepub fn get_stats<K: Hash, A: AccessStatsCollector>(
&self,
k: &K,
access_stats: &mut A
) -> Option<u8>
pub fn get_stats<K: Hash, A: AccessStatsCollector>( &self, k: &K, access_stats: &mut A ) -> Option<u8>
Gets the value associated with the given key k and reports statistics to access_stats.
sourcepub fn get<K: Hash>(&self, k: &K) -> Option<u8>
pub fn get<K: Hash>(&self, k: &K) -> Option<u8>
Gets the value associated with the given key k.
pub fn with_slices_conf<K: Hash, LSC: SimpleLevelSizeChooser, CSB: CollisionSolverBuilder>( keys: &mut [K], values: &mut [u8], conf: MapConf<LSC, CSB, S> ) -> Self
sourcepub fn write_bytes(&self) -> usize
pub fn write_bytes(&self) -> usize
Returns number of bytes which write will write.
sourcepub fn read_with_hasher(input: &mut dyn Read, hasher: S) -> Result<Self>
pub fn read_with_hasher(input: &mut dyn Read, hasher: S) -> Result<Self>
Read self
from the input
(hasher
must be the same as used by written Map
).
source§impl<S: BuildSeededHasher> Map<S>
impl<S: BuildSeededHasher> Map<S>
pub fn with_map_conf<K: Hash + Clone, H, LSC: SimpleLevelSizeChooser, CSB: CollisionSolverBuilder, BS: BuildStatsCollector>( map: &HashMap<K, u8, H>, conf: MapConf<LSC, CSB, S>, stats: &mut BS ) -> Self
Trait Implementations§
source§impl<S: BuildSeededHasher> GetSize for Map<S>
impl<S: BuildSeededHasher> GetSize for Map<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<S> RefUnwindSafe for Map<S>where
S: RefUnwindSafe,
impl<S> Send for Map<S>where
S: Send,
impl<S> Sync for Map<S>where
S: Sync,
impl<S> Unpin for Map<S>where
S: Unpin,
impl<S> UnwindSafe for Map<S>where
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