Struct rkyv::collections::index_map::ArchivedIndexMap
source · #[repr(C)]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) -> bool
pub fn contains_key<Q>(&self, k: &Q) -> bool
Returns whether a key is present in the hash map.
sourcepub fn get_full<Q>(&self, k: &Q) -> Option<(usize, &K, &V)>
pub fn get_full<Q>(&self, k: &Q) -> Option<(usize, &K, &V)>
Gets the index, key, and value associated with the given key.
sourcepub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
Gets the index of a key if it exists in the map.
sourcepub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>
pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>
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>
impl<K, V, C> CheckBytes<C> for ArchivedIndexMap<K, V>
§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
source§impl<K, V, D, S> Deserialize<IndexMap<K, V, S>, D> for ArchivedIndexMap<K::Archived, V::Archived>where
K: Archive + Hash + Eq,
K::Archived: Deserialize<K, D>,
V: Archive,
V::Archived: Deserialize<V, D>,
D: Fallible + ?Sized,
S: Default + BuildHasher,
impl<K, V, D, S> Deserialize<IndexMap<K, V, S>, D> for ArchivedIndexMap<K::Archived, V::Archived>where
K: Archive + Hash + Eq,
K::Archived: Deserialize<K, D>,
V: Archive,
V::Archived: Deserialize<V, D>,
D: Fallible + ?Sized,
S: Default + BuildHasher,
source§impl<UK, K, UV, V, S> PartialEq<IndexMap<UK, UV, S>> for ArchivedIndexMap<K, V>
impl<UK, K, UV, V, S> PartialEq<IndexMap<UK, UV, S>> for ArchivedIndexMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for ArchivedIndexMap<K, V>
impl<K, V> RefUnwindSafe for ArchivedIndexMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for ArchivedIndexMap<K, V>
impl<K, V> Sync for ArchivedIndexMap<K, V>
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<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 F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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.