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

An archived HashMap.

Implementations§

source§

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

source

pub const fn len(&self) -> usize

Gets the number of items in the hash map.

source

pub fn hasher(&self) -> SeaHasher

Gets the hasher for this hashmap. The hasher for all archived hashmaps is the same for reproducibility.

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub const fn is_empty(&self) -> bool

Returns true if the map contains no elements.

source

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

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

source

pub fn iter_pin(self: Pin<&mut Self>) -> IterPin<'_, K, V>

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

source

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

Gets an iterator over the keys in the hash map.

source

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

Gets an iterator over the values in the hash map.

source

pub fn values_pin(self: Pin<&mut Self>) -> ValuesPin<'_, K, V>

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

source

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 serialized
  • pos must be the position of out within the archive
  • resolver must be the result of serializing a hash map
source§

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

source

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,

§

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>

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

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

source§

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

Formats the value using the given formatter. 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>,

source§

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

Deserializes using the given deserializer
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>,

source§

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

Deserializes using the given deserializer
source§

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

§

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: 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<K: Hash + Eq, V: PartialEq> PartialEq<ArchivedHashMap<K, V>> for ArchivedHashMap<K, V>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

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 Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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>

Gets the layout of the type.
source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.