RequiredDict

Struct RequiredDict 

Source
pub struct RequiredDict<K: DictKey, V> { /* private fields */ }
Expand description

A dictionary that requires all keys to have values

Implementations§

Source§

impl<K: DictKey, V> RequiredDict<K, V>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn from_fn<F>(f: F) -> Self
where F: FnMut(K) -> V,

Source

pub fn try_from_fn<F, E>(f: F) -> Result<Self, E>
where F: FnMut(K) -> Result<V, E>,

Source

pub fn map<F, U>(self, f: F) -> RequiredDict<K, U>
where F: FnMut(V) -> U,

Source

pub fn try_map<F, U, E>(self, f: F) -> Result<RequiredDict<K, U>, E>
where F: FnMut(V) -> Result<U, E>,

Source

pub fn each_ref(&self) -> RequiredDict<K, &V>

Source

pub fn each_mut(&mut self) -> RequiredDict<K, &mut V>

Source

pub fn downgrade(self) -> OptionalDict<K, V>

Trait Implementations§

Source§

impl<K: DictKey, V: Clone> Clone for RequiredDict<K, V>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<K: DictKey, V: Debug> Debug for RequiredDict<K, V>

Source§

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

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

impl<K: DictKey, V: Default> Default for RequiredDict<K, V>

Source§

fn default() -> Self

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

impl<K: DictKey, V: Display> Display for RequiredDict<K, V>

Source§

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

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

impl<K: DictKey, V> From<OptionalDict<K, V>> for RequiredDict<K, Option<V>>

Source§

fn from(dict: OptionalDict<K, V>) -> Self

Converts to this type from the input type.
Source§

impl<K: DictKey, V> From<RequiredDict<K, Option<V>>> for OptionalDict<K, V>

Source§

fn from(dict: RequiredDict<K, Option<V>>) -> Self

Converts to this type from the input type.
Source§

impl<K: DictKey, V: Hash> Hash for RequiredDict<K, V>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<K: DictKey, V> Index<K> for RequiredDict<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: DictKey, V> IndexMut<K> for RequiredDict<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: DictKey, V> IntoIterator for RequiredDict<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
Source§

impl<K: DictKey, V: Ord> Ord for RequiredDict<K, V>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<K: DictKey, V: PartialEq> PartialEq for RequiredDict<K, V>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<K: DictKey, V: PartialOrd> PartialOrd for RequiredDict<K, V>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<K: DictKey, V: Copy> Copy for RequiredDict<K, V>
where K::Array<V>: Copy,

Source§

impl<K: DictKey, V: Eq> Eq for RequiredDict<K, V>

Auto Trait Implementations§

§

impl<K, V> Freeze for RequiredDict<K, V>
where <K as DictKey>::Array<V>: Freeze,

§

impl<K, V> RefUnwindSafe for RequiredDict<K, V>
where <K as DictKey>::Array<V>: RefUnwindSafe, K: RefUnwindSafe,

§

impl<K, V> Send for RequiredDict<K, V>
where <K as DictKey>::Array<V>: Send, K: Send,

§

impl<K, V> Sync for RequiredDict<K, V>
where <K as DictKey>::Array<V>: Sync, K: Sync,

§

impl<K, V> Unpin for RequiredDict<K, V>
where <K as DictKey>::Array<V>: Unpin, K: Unpin,

§

impl<K, V> UnwindSafe for RequiredDict<K, V>
where <K as DictKey>::Array<V>: UnwindSafe, K: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.