TinySecondaryMap

Struct TinySecondaryMap 

Source
pub struct TinySecondaryMap<K: Key, V> { /* private fields */ }

Implementations§

Source§

impl<K: Key, V> TinySecondaryMap<K, V>

Source

pub unsafe fn iter_many_unchecked_mut<'a, I>( &'a mut self, keys: I, ) -> IterManyMut<'a, K, V, I::IntoIter>
where I: IntoIterator<Item = K>, <I as IntoIterator>::IntoIter: 'a,

Returns an iterator of mutable references to the values corresponding to the keys.

§Safety

The caller must ensure that the keys are valid and unique, otherwise the returned references will UB.

Source§

impl<K: Key, V> TinySecondaryMap<K, V>

Source

pub fn new() -> Self

Construct a new, empty TinySecondaryMap.

Source

pub fn with_capacity(capacity: usize) -> Self

Creates an emtpy TinySecondaryMap with the given capacity.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn insert(&mut self, key: K, value: V) -> Option<V>

Inserts or replaces a value into the secondary map at the given key. Returns None if the key was not present, otherwise returns the previous value.

Source

pub fn extend(&mut self, values: impl IntoIterator<Item = (K, V)>)

Source

pub fn contains_key(&self, key: K) -> bool

Source

pub fn get(&self, key: K) -> Option<&V>

Returns a reference to the value corresponding to the key.

Source

pub fn get_mut(&mut self, key: K) -> Option<&mut V>

Returns a mutable reference to the value corresponding to the key.

Source

pub fn first_key(&self) -> Option<K>

Returns the first non-empty key in the map.

Source

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

Returns an iterator over the (K, V) entries in the map.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, K, V>

Source

pub fn keys(&self) -> impl Iterator<Item = K> + '_

Returns an iterator over the keys in the map.

Source

pub fn into_keys(self) -> Vec<K>

Turns the map into a vector of the keys in the map.

Source

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

Returns an iterator over the values in the map, ordered by key.

Trait Implementations§

Source§

impl<K: Clone + Key, V: Clone> Clone for TinySecondaryMap<K, V>

Source§

fn clone(&self) -> TinySecondaryMap<K, V>

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: Key + Debug, V: Debug> Debug for TinySecondaryMap<K, V>

Source§

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

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

impl<K: Key, V> Default for TinySecondaryMap<K, V>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<K: Key, V> Extend<(K, V)> for TinySecondaryMap<K, V>

Source§

fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<K: Key, V> FromIterator<(K, V)> for TinySecondaryMap<K, V>

Source§

fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<K: Key, V> Index<K> for TinySecondaryMap<K, V>

Source§

type Output = V

The returned type after indexing.
Source§

fn index(&self, key: K) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<K: Key, V> IndexMut<K> for TinySecondaryMap<K, V>

Source§

fn index_mut(&mut self, key: K) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<K: Key, V> IntoIterator for TinySecondaryMap<K, V>

Source§

type Item = (K, V)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<K, V>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<K, V> Freeze for TinySecondaryMap<K, V>

§

impl<K, V> RefUnwindSafe for TinySecondaryMap<K, V>

§

impl<K, V> Send for TinySecondaryMap<K, V>
where K: Send, V: Send,

§

impl<K, V> Sync for TinySecondaryMap<K, V>
where K: Sync, V: Sync,

§

impl<K, V> Unpin for TinySecondaryMap<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> UnwindSafe for TinySecondaryMap<K, V>
where K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

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

Performs the conversion.