Struct rkyv::collections::hash_map::ArchivedHashMap
source · pub struct ArchivedHashMap<K, V> { /* private fields */ }
Expand description
An archived HashMap
.
Implementations§
source§impl<K, V> ArchivedHashMap<K, V>
impl<K, V> ArchivedHashMap<K, V>
sourcepub fn hasher(&self) -> SeaHasher
pub fn hasher(&self) -> SeaHasher
Gets the hasher for this hashmap. The hasher for all archived hashmaps is the same for reproducibility.
sourcepub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
Finds the key-value entry for a key.
sourcepub fn get_key_value_pin<Q>(
self: Pin<&mut Self>,
k: &Q
) -> Option<(&K, Pin<&mut V>)>where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get_key_value_pin<Q>( self: Pin<&mut Self>, k: &Q ) -> Option<(&K, Pin<&mut V>)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
Finds the mutable key-value entry for a key.
sourcepub fn contains_key<Q>(&self, k: &Q) -> boolwhere
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn contains_key<Q>(&self, k: &Q) -> boolwhere K: Borrow<Q>, Q: Hash + Eq + ?Sized,
Returns whether a key is present in the hash map.
sourcepub fn get<Q>(&self, k: &Q) -> Option<&V>where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get<Q>(&self, k: &Q) -> Option<&V>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
Gets the value associated with the given key.
sourcepub fn get_pin<Q>(self: Pin<&mut Self>, k: &Q) -> Option<Pin<&mut V>>where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get_pin<Q>(self: Pin<&mut Self>, k: &Q) -> Option<Pin<&mut V>>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
Gets the mutable value associated with the given key.
sourcepub fn iter(&self) -> Iter<'_, K, V> ⓘ
pub fn iter(&self) -> Iter<'_, K, V> ⓘ
Gets an iterator over the key-value entries in the hash map.
sourcepub fn iter_pin(self: Pin<&mut Self>) -> IterPin<'_, K, V> ⓘ
pub fn iter_pin(self: Pin<&mut Self>) -> IterPin<'_, K, V> ⓘ
Gets an iterator over the mutable key-value entries in the hash map.
sourcepub fn values_pin(self: Pin<&mut Self>) -> ValuesPin<'_, K, V> ⓘ
pub fn values_pin(self: Pin<&mut Self>) -> ValuesPin<'_, K, V> ⓘ
Gets an iterator over the mutable values in the hash map.
sourcepub unsafe fn resolve_from_len(
len: usize,
pos: usize,
resolver: HashMapResolver,
out: *mut Self
)
pub unsafe fn resolve_from_len( len: usize, pos: usize, resolver: HashMapResolver, out: *mut Self )
Resolves an archived hash map from a given length and parameters.
Safety
len
must be the number of elements that were serializedpos
must be the position ofout
within the archiveresolver
must be the result of serializing a hash map
source§impl<K, V> ArchivedHashMap<K, V>
impl<K, V> ArchivedHashMap<K, V>
sourcepub unsafe fn serialize_from_iter<'a, KU, VU, S, I>(
iter: I,
serializer: &mut S
) -> Result<HashMapResolver, S::Error>where
KU: 'a + Serialize<S, Archived = K> + Hash + Eq,
VU: 'a + Serialize<S, Archived = V>,
S: Serializer + ScratchSpace + ?Sized,
I: ExactSizeIterator<Item = (&'a KU, &'a VU)>,
pub unsafe fn serialize_from_iter<'a, KU, VU, S, I>( iter: I, serializer: &mut S ) -> Result<HashMapResolver, S::Error>where KU: 'a + Serialize<S, Archived = K> + Hash + Eq, VU: 'a + Serialize<S, Archived = V>, S: Serializer + ScratchSpace + ?Sized, I: ExactSizeIterator<Item = (&'a KU, &'a VU)>,
Serializes an iterator of key-value pairs as a hash map.
Safety
The keys returned by the iterator must be unique.
Trait Implementations§
source§impl<K, V, C> CheckBytes<C> for ArchivedHashMap<K, V>where
K: CheckBytes<C> + Eq + Hash,
V: CheckBytes<C>,
C: ArchiveContext + ?Sized,
C::Error: Error,
impl<K, V, C> CheckBytes<C> for ArchivedHashMap<K, V>where K: CheckBytes<C> + Eq + Hash, V: CheckBytes<C>, C: ArchiveContext + ?Sized, C::Error: Error,
§type Error = HashMapError<<K as CheckBytes<C>>::Error, <V as CheckBytes<C>>::Error, <C as Fallible>::Error>
type Error = HashMapError<<K as CheckBytes<C>>::Error, <V as CheckBytes<C>>::Error, <C as Fallible>::Error>
The error that may result from checking the type.
source§unsafe fn check_bytes<'a>(
value: *const Self,
context: &mut C
) -> Result<&'a Self, Self::Error>
unsafe fn check_bytes<'a>( value: *const Self, context: &mut C ) -> Result<&'a Self, Self::Error>
Checks whether the given pointer points to a valid value within the
given context. Read more
source§impl<K: Archive + Hash + Eq, V: Archive, D: Fallible + ?Sized, S: Default + BuildHasher> Deserialize<HashMap<K, V, S>, D> for ArchivedHashMap<K::Archived, V::Archived>where
K::Archived: Deserialize<K, D> + Hash + Eq,
V::Archived: Deserialize<V, D>,
impl<K: Archive + Hash + Eq, V: Archive, D: Fallible + ?Sized, S: Default + BuildHasher> Deserialize<HashMap<K, V, S>, D> for ArchivedHashMap<K::Archived, V::Archived>where K::Archived: Deserialize<K, D> + Hash + Eq, V::Archived: Deserialize<V, D>,
source§impl<K: Archive + Hash + Eq, V: Archive, D: Fallible + ?Sized, S: Default + BuildHasher> Deserialize<HashMap<K, V, S, Global>, D> for ArchivedHashMap<K::Archived, V::Archived>where
K::Archived: Deserialize<K, D> + Hash + Eq,
V::Archived: Deserialize<V, D>,
impl<K: Archive + Hash + Eq, V: Archive, D: Fallible + ?Sized, S: Default + BuildHasher> Deserialize<HashMap<K, V, S, Global>, D> for ArchivedHashMap<K::Archived, V::Archived>where K::Archived: Deserialize<K, D> + Hash + Eq, V::Archived: Deserialize<V, D>,
source§impl<K: Hash + Eq + Borrow<AK>, V, AK: Hash + Eq, AV: PartialEq<V>> PartialEq<ArchivedHashMap<AK, AV>> for HashMap<K, V>
impl<K: Hash + Eq + Borrow<AK>, V, AK: Hash + Eq, AV: PartialEq<V>> PartialEq<ArchivedHashMap<AK, AV>> for HashMap<K, V>
source§fn eq(&self, other: &ArchivedHashMap<AK, AV>) -> bool
fn eq(&self, other: &ArchivedHashMap<AK, AV>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<K: Hash + Eq + Borrow<AK>, V, AK: Hash + Eq, AV: PartialEq<V>> PartialEq<ArchivedHashMap<AK, AV>> for HashMap<K, V>
impl<K: Hash + Eq + Borrow<AK>, V, AK: Hash + Eq, AV: PartialEq<V>> PartialEq<ArchivedHashMap<AK, AV>> for HashMap<K, V>
source§fn eq(&self, other: &ArchivedHashMap<AK, AV>) -> bool
fn eq(&self, other: &ArchivedHashMap<AK, AV>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<K: Hash + Eq, V: PartialEq> PartialEq<ArchivedHashMap<K, V>> for ArchivedHashMap<K, V>
impl<K: Hash + Eq, V: PartialEq> PartialEq<ArchivedHashMap<K, V>> for ArchivedHashMap<K, V>
source§impl<K: Hash + Eq + Borrow<AK>, V, AK: Hash + Eq, AV: PartialEq<V>, S: BuildHasher> PartialEq<HashMap<K, V, S>> for ArchivedHashMap<AK, AV>
impl<K: Hash + Eq + Borrow<AK>, V, AK: Hash + Eq, AV: PartialEq<V>, S: BuildHasher> PartialEq<HashMap<K, V, S>> for ArchivedHashMap<AK, AV>
source§impl<K: Hash + Eq + Borrow<AK>, V, AK: Hash + Eq, AV: PartialEq<V>, S: BuildHasher> PartialEq<HashMap<K, V, S, Global>> for ArchivedHashMap<AK, AV>
impl<K: Hash + Eq + Borrow<AK>, V, AK: Hash + Eq, AV: PartialEq<V>, S: BuildHasher> PartialEq<HashMap<K, V, S, Global>> for ArchivedHashMap<AK, AV>
impl<K: Hash + Eq, V: Eq> Eq for ArchivedHashMap<K, V>
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for ArchivedHashMap<K, V>where K: RefUnwindSafe, V: RefUnwindSafe,
impl<K, V> Send for ArchivedHashMap<K, V>where K: Send, V: Send,
impl<K, V> Sync for ArchivedHashMap<K, V>where K: Sync, V: Sync,
impl<K, V> !Unpin for ArchivedHashMap<K, V>
impl<K, V> UnwindSafe for ArchivedHashMap<K, V>where K: UnwindSafe, V: UnwindSafe,
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
source§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.