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

An archived IndexMap.

Implementations§

source§

impl<K, V> ArchivedIndexMap<K, V>

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 first(&self) -> Option<(&K, &V)>

Returns the first key-value pair.

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_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.

source

pub fn get_index(&self, index: usize) -> Option<(&K, &V)>

Gets a key-value pair by index.

source

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.

source

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.

source

pub fn hasher(&self) -> HashBuilder

Gets the hasher for this index map.

source

pub const fn is_empty(&self) -> bool

Returns true if the map contains no elements.

source

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

Returns an iterator over the key-value pairs of the map in order

source

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

Returns an iterator over the keys of the map in order

source

pub fn last(&self) -> Option<(&K, &V)>

Returns the last key-value pair.

source

pub const fn len(&self) -> usize

Gets the number of items in the index map.

source

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

Returns an iterator over the values of the map in order.

source

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 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> ArchivedIndexMap<K, V>

source

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,

§

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>

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

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

source§

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

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

impl<K: PartialEq, V: PartialEq> PartialEq<ArchivedIndexMap<K, V>> for ArchivedIndexMap<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.

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · 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

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.