rkyv::collections::swiss_table::map

Struct ArchivedHashMap

Source
pub struct ArchivedHashMap<K, V, H = FxHasher64> { /* private fields */ }
Expand description

An archived SwissTable hash map.

Implementations§

Source§

impl<K, V, H> ArchivedHashMap<K, V, H>

Source

pub const fn is_empty(&self) -> bool

Returns whether the hash map is empty.

Source

pub const fn len(&self) -> usize

Returns the number of elements in the hash map.

Source

pub fn capacity(&self) -> usize

Returns the total capacity of the hash map.

Source

pub fn iter(&self) -> Iter<'_, K, V, H>

Returns an iterator over the key-value entries in the hash map.

Source

pub fn iter_seal(this: Seal<'_, Self>) -> IterMut<'_, K, V, H>

Returns an iterator over the sealed key-value entries in the hash map.

Source

pub fn keys(&self) -> Keys<'_, K, V, H>

Returns an iterator over the keys in the hash map.

Source

pub fn values(&self) -> Values<'_, K, V, H>

Returns an iterator over the values in the hash map.

Source

pub fn values_seal(this: Seal<'_, Self>) -> ValuesMut<'_, K, V, H>

Returns an iterator over the mutable values in the hash map.

Source§

impl<K, V, H: Hasher + Default> ArchivedHashMap<K, V, H>

Source

pub fn get_key_value_with<Q, C>(&self, key: &Q, cmp: C) -> Option<(&K, &V)>
where Q: Hash + Eq + ?Sized, C: Fn(&Q, &K) -> bool,

Returns the key-value pair corresponding to the supplied key using the given comparison function.

Source

pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Returns the key-value pair corresponding to the supplied key.

Source

pub fn get_with<Q, C>(&self, key: &Q, cmp: C) -> Option<&V>
where Q: Hash + Eq + ?Sized, C: Fn(&Q, &K) -> bool,

Returns a reference to the value corresponding to the supplied key using the given comparison function.

Source

pub fn get<Q>(&self, key: &Q) -> Option<&V>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Returns a reference to the value corresponding to the supplied key.

Source

pub fn get_key_value_seal_with<'a, Q, C>( this: Seal<'a, Self>, key: &Q, cmp: C, ) -> Option<(&'a K, Seal<'a, V>)>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized, C: Fn(&Q, &K) -> bool,

Returns the mutable key-value pair corresponding to the supplied key using the given comparison function.

Source

pub fn get_key_value_seal<'a, Q>( this: Seal<'a, Self>, key: &Q, ) -> Option<(&'a K, Seal<'a, V>)>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Returns the mutable key-value pair corresponding to the supplied key.

Source

pub fn get_seal_with<'a, Q, C>( this: Seal<'a, Self>, key: &Q, cmp: C, ) -> Option<Seal<'a, V>>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized, C: Fn(&Q, &K) -> bool,

Returns a mutable reference to the value corresponding to the supplied key using the given comparison function.

Source

pub fn get_seal<'a, Q>(this: Seal<'a, Self>, key: &Q) -> Option<Seal<'a, V>>
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Returns a mutable reference to the value corresponding to the supplied key.

Source

pub fn contains_key<Q>(&self, key: &Q) -> bool
where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Returns whether the hash map contains the given key.

Source

pub fn serialize_from_iter<I, BKU, BVU, KU, VU, S>( iter: I, load_factor: (usize, usize), serializer: &mut S, ) -> Result<HashMapResolver, S::Error>
where I: Clone + ExactSizeIterator<Item = (BKU, BVU)>, BKU: Borrow<KU>, BVU: Borrow<VU>, KU: Serialize<S, Archived = K> + Hash + Eq, VU: Serialize<S, Archived = V>, S: Fallible + Writer + Allocator + ?Sized, S::Error: Source,

Serializes an iterator of key-value pairs as a hash map.

Source

pub fn resolve_from_len( len: usize, load_factor: (usize, usize), resolver: HashMapResolver, out: Place<Self>, )

Resolves an archived hash map from a given length and parameters.

Trait Implementations§

Source§

impl<K, V, H, __C: Fallible + ?Sized> CheckBytes<__C> for ArchivedHashMap<K, V, H>
where <__C as Fallible>::Error: Trace, ArchivedHashTable<Entry<K, V>>: CheckBytes<__C>, PhantomData<H>: CheckBytes<__C>,

Source§

unsafe fn check_bytes( value: *const Self, context: &mut __C, ) -> Result<(), <__C as Fallible>::Error>

Checks whether the given pointer points to a valid value within the given context. Read more
Source§

impl<K, V, H> Debug for ArchivedHashMap<K, V, H>
where K: Debug, V: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, V, D, S> Deserialize<HashMap<K, V, S>, D> for ArchivedHashMap<K::Archived, V::Archived>
where K: Archive + Hash + Eq, K::Archived: Deserialize<K, D> + Hash + Eq, V: Archive, V::Archived: Deserialize<V, D>, D: Fallible + ?Sized, S: Default + BuildHasher,

Available on crate feature std only.
Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<HashMap<K, V, S>, D::Error>

Deserializes using the given deserializer
Source§

impl<A, B, K, V, D, S> DeserializeWith<ArchivedHashMap<<A as ArchiveWith<K>>::Archived, <B as ArchiveWith<V>>::Archived>, HashMap<K, V, S>, D> for MapKV<A, B>
where A: ArchiveWith<K> + DeserializeWith<<A as ArchiveWith<K>>::Archived, K, D>, B: ArchiveWith<V> + DeserializeWith<<B as ArchiveWith<V>>::Archived, V, D>, K: Ord + Hash + Eq, D: Fallible + ?Sized, S: Default + BuildHasher,

Available on crate feature std only.
Source§

fn deserialize_with( field: &ArchivedHashMap<<A as ArchiveWith<K>>::Archived, <B as ArchiveWith<V>>::Archived>, deserializer: &mut D, ) -> Result<HashMap<K, V, S>, <D as Fallible>::Error>

Deserializes the field type F using the given deserializer.
Source§

impl<K, Q, V, H> Index<&Q> for ArchivedHashMap<K, V, H>
where K: Eq + Hash + Borrow<Q>, Q: Eq + Hash + ?Sized, H: Default + Hasher,

Source§

type Output = V

The returned type after indexing.
Source§

fn index(&self, key: &Q) -> &V

Performs the indexing (container[index]) operation. Read more
Source§

impl<K, V, AK, AV> PartialEq<ArchivedHashMap<AK, AV>> for HashMap<K, V>
where K: Hash + Eq + Borrow<AK>, AK: Hash + Eq, AV: PartialEq<V>,

Available on crate feature std only.
Source§

fn eq(&self, other: &ArchivedHashMap<AK, AV>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<K, V, AK, AV, S> PartialEq<HashMap<K, V, S>> for ArchivedHashMap<AK, AV>
where K: Hash + Eq + Borrow<AK>, AK: Hash + Eq, AV: PartialEq<V>, S: BuildHasher,

Available on crate feature std only.
Source§

fn eq(&self, other: &HashMap<K, V, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<K, V, H> PartialEq for ArchivedHashMap<K, V, H>
where K: Hash + Eq, V: PartialEq, H: Default + Hasher,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<K, V, H> Eq for ArchivedHashMap<K, V, H>
where K: Hash + Eq, V: Eq, H: Default + Hasher,

Source§

impl<K, V, H> Portable for ArchivedHashMap<K, V, H>

Auto Trait Implementations§

§

impl<K, V, H> Freeze for ArchivedHashMap<K, V, H>

§

impl<K, V, H> RefUnwindSafe for ArchivedHashMap<K, V, H>

§

impl<K, V, H> Send for ArchivedHashMap<K, V, H>
where H: Send, K: Send, V: Send,

§

impl<K, V, H> Sync for ArchivedHashMap<K, V, H>
where H: Sync, K: Sync, V: Sync,

§

impl<K, V, H = FxHasher64> !Unpin for ArchivedHashMap<K, V, H>

§

impl<K, V, H> UnwindSafe for ArchivedHashMap<K, V, H>
where H: UnwindSafe, K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.