Struct rkyv::collections::index_map::ArchivedIndexMap
source · pub struct ArchivedIndexMap<K, V> { /* private fields */ }
Expand description
An archived IndexMap
.
Implementations§
source§impl<K, V> ArchivedIndexMap<K, V>
impl<K, V> ArchivedIndexMap<K, V>
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_full<Q>(&self, k: &Q) -> Option<(usize, &K, &V)>where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get_full<Q>(&self, k: &Q) -> Option<(usize, &K, &V)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
Gets the index, key, and value associated with the given key.
sourcepub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>where
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
Gets the index of a key if it exists in the map.
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,
Gets the key-value pair associated with the given key.
sourcepub fn hasher(&self) -> HashBuilder
pub fn hasher(&self) -> HashBuilder
Gets the hasher for this index map.
sourcepub fn iter(&self) -> Iter<'_, K, V> ⓘ
pub fn iter(&self) -> Iter<'_, K, V> ⓘ
Returns an iterator over the key-value pairs of the map in order
sourcepub fn values(&self) -> Values<'_, K, V> ⓘ
pub fn values(&self) -> Values<'_, K, V> ⓘ
Returns an iterator over the values of the map in order.
sourcepub unsafe fn resolve_from_len(
len: usize,
pos: usize,
resolver: IndexMapResolver,
out: *mut Self
)
pub unsafe fn resolve_from_len( len: usize, pos: usize, resolver: IndexMapResolver, out: *mut Self )
Resolves an archived index 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> ArchivedIndexMap<K, V>
impl<K, V> ArchivedIndexMap<K, V>
sourcepub unsafe fn serialize_from_iter_index<'a, UK, UV, I, F, S>(
iter: I,
index: F,
serializer: &mut S
) -> Result<IndexMapResolver, S::Error>where
UK: 'a + Serialize<S, Archived = K> + Hash + Eq,
UV: 'a + Serialize<S, Archived = V>,
I: Clone + ExactSizeIterator<Item = (&'a UK, &'a UV)>,
F: Fn(&UK) -> usize,
S: Serializer + ScratchSpace + ?Sized,
pub unsafe fn serialize_from_iter_index<'a, UK, UV, I, F, S>( iter: I, index: F, serializer: &mut S ) -> Result<IndexMapResolver, S::Error>where UK: 'a + Serialize<S, Archived = K> + Hash + Eq, UV: 'a + Serialize<S, Archived = V>, I: Clone + ExactSizeIterator<Item = (&'a UK, &'a UV)>, F: Fn(&UK) -> usize, S: Serializer + ScratchSpace + ?Sized,
Serializes an iterator of key-value pairs as an index map.
Safety
- The keys returned by the iterator must be unique
- The index function must return the index of the given key within the iterator
Trait Implementations§
source§impl<K, V, C> CheckBytes<C> for ArchivedIndexMap<K, V>where
K: CheckBytes<C> + Eq + Hash,
V: CheckBytes<C>,
C: ArchiveContext + ?Sized,
C::Error: Error,
impl<K, V, C> CheckBytes<C> for ArchivedIndexMap<K, V>where K: CheckBytes<C> + Eq + Hash, V: CheckBytes<C>, C: ArchiveContext + ?Sized, C::Error: Error,
§type Error = IndexMapError<<K as CheckBytes<C>>::Error, <V as CheckBytes<C>>::Error, <C as Fallible>::Error>
type Error = IndexMapError<<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
Auto Trait Implementations§
impl<K, V> RefUnwindSafe for ArchivedIndexMap<K, V>where K: RefUnwindSafe, V: RefUnwindSafe,
impl<K, V> Send for ArchivedIndexMap<K, V>where K: Send, V: Send,
impl<K, V> Sync for ArchivedIndexMap<K, V>where K: Sync, V: Sync,
impl<K, V> !Unpin for ArchivedIndexMap<K, V>
impl<K, V> UnwindSafe for ArchivedIndexMap<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<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.