Struct erg_common::dict::Dict

source ·
pub struct Dict<K, V> { /* private fields */ }

Implementations§

source§

impl<K, V> Dict<K, V>

source

pub fn new() -> Self

source

pub fn with_capacity(capacity: usize) -> Self

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

pub fn capacity(&self) -> usize

source

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

source

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

source

pub fn values_mut(&mut self) -> ValuesMut<'_, K, V>

source

pub fn into_values(self) -> IntoValues<K, V>

source

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

source

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

source

pub fn clear(&mut self)

source

pub fn retain<F>(&mut self, f: F)where F: FnMut(&K, &mut V) -> bool,

remove all elements for which the predicate returns false

source§

impl<K: Hash + Eq, V> Dict<K, V>

source

pub fn get<Q>(&self, k: &Q) -> Option<&V>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

source

pub fn get_by(&self, k: &K, cmp: impl Fn(&K, &K) -> bool) -> Option<&V>

source

pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

source

pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

source

pub fn contains_key<Q>(&self, k: &Q) -> boolwhere K: Borrow<Q>, Q: Hash + Eq + ?Sized,

source

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

source

pub fn remove<Q>(&mut self, k: &Q) -> Option<V>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

source

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

NOTE: This method does not consider pairing with values and keys. That is, a value may be paired with a different key (can be considered equal). If you need to consider the pairing of the keys and values, use guaranteed_extend instead.

source

pub fn guaranteed_extend<I: IntoIterator<Item = (K, V)>>(&mut self, other: I)

source

pub fn merge(&mut self, other: Self)

source

pub fn concat(self, other: Self) -> Self

source

pub fn diff(self, other: &Self) -> Self

source

pub fn entry(&mut self, k: K) -> Entry<'_, K, V>

Trait Implementations§

source§

impl<K: Clone, V: Clone> Clone for Dict<K, V>

source§

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

Returns a copy 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: Debug, V: Debug> Debug for Dict<K, V>

source§

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

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

impl<K, V> Default for Dict<K, V>

source§

fn default() -> Dict<K, V>

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

impl<K: Display, V: Display> Display for Dict<K, V>

source§

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

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

impl<K: Hash + Eq, V> FromIterator<(K, V)> for Dict<K, V>

source§

fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Dict<K, V>

Creates a value from an iterator. Read more
source§

impl<K: Hash, V: Hash> Hash for Dict<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, V> IntoIterator for Dict<K, V>

§

type Item = (K, V)

The type of the elements being iterated over.
§

type IntoIter = <HashMap<K, V, BuildHasherDefault<FxHasher>> as IntoIterator>::IntoIter

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: Hash + Eq, V: Hash + Eq> PartialEq<Dict<K, V>> for Dict<K, V>

source§

fn eq(&self, other: &Dict<K, V>) -> 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: Hash + Eq> Eq for Dict<K, V>

Auto Trait Implementations§

§

impl<K, V> RefUnwindSafe for Dict<K, V>where K: RefUnwindSafe, V: RefUnwindSafe,

§

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

§

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

§

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

§

impl<K, V> UnwindSafe for Dict<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> 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<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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

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

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

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.