Struct Dictionary

Source
pub struct Dictionary<V>{ /* private fields */ }
Expand description

A ‘dictionary’ is a ‘collection’ containing ‘string’ label keys associated with a value.

Implementations§

Source§

impl<V> Dictionary<V>

Source

pub fn new() -> Self

Creates a new empty ‘dictionary’.

Source

pub fn from_vec(v: &Vec<KeyValue<String, V>>) -> Self

Creates a new ‘dictionary’ that contains the elements in the specified vector.

Trait Implementations§

Source§

impl<V> Clear for Dictionary<V>

Source§

fn clear(&mut self)

Clears all the elements from this ‘dictionary’.

Source§

impl<V> Clone for Dictionary<V>

Source§

fn clone(&self) -> Self

Returns a clone of this ‘dictionary’.

1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<V> Collection for Dictionary<V>

Source§

type Element = KeyValue<String, V>

The element type.

Source§

fn capacity(&self) -> usize

Returns the capacity of this ‘dictionary’.

Source§

fn contains(&self, item: &KeyValue<String, V>) -> bool

Returns true if this ‘dictionary’ contains the specified item.

Source§

fn contains_all(&self, vec: &Vec<KeyValue<String, V>>) -> bool

Returns true if this ‘dictionary’ contains the specified vector.

Source§

fn to_vec(&self) -> Vec<KeyValue<String, V>>

Returns this ‘dictionary’ as a ‘vector’.

Source§

impl<V> Debug for Dictionary<V>

Source§

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

Displays debug information for this ‘dictionary’.

Source§

impl<V> Empty for Dictionary<V>

Source§

fn is_empty(&self) -> bool

Returns true if this ‘dictionary’ is empty.

Source§

impl<V> Index<&str> for Dictionary<V>

Source§

type Output = V

Output type.

Source§

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

Returns the value associated with the specified key.

§Panics

This function panics if the key does not exist in this ‘dictionary’.

Source§

impl<V> Index<String> for Dictionary<V>

Source§

type Output = V

Output type.

Source§

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

Returns the value associated with the specified key.

§Panics

This function panics if the key does not exist in this ‘dictionary’.

Source§

impl<V> IndexMut<&str> for Dictionary<V>

Source§

fn index_mut(&mut self, index: &str) -> &mut Self::Output

Returns the value associated with the specified key.

§Panics

This function panics if the key does not exist in this ‘dictionary’.

Source§

impl<V> IndexMut<String> for Dictionary<V>

Source§

fn index_mut(&mut self, index: String) -> &mut Self::Output

Returns the value associated with the specified key.

§Panics

This function panics if the key does not exist in this ‘dictionary’.

Source§

impl<V> IntoIterator for Dictionary<V>

Source§

type Item = KeyValue<String, V>

Item type.

Source§

type IntoIter = IntoIter<KeyValue<String, V>>

IntoIter type.

Source§

fn into_iter(self) -> Self::IntoIter

Returns an iterator for this ‘dictionary’.

Source§

impl<V> Len for Dictionary<V>

Source§

fn len(&self) -> usize

Returns the length of this ‘dictionary’.

Source§

impl<V> MapCollection<String, V> for Dictionary<V>

Source§

fn exists(&self, key: String) -> bool

Returns true if the specified key exists.

Source§

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

Returns the value associated with the specified key, or None if the key does not exist.

Source§

fn insert(&mut self, pair: KeyValue<String, V>) -> bool

Inserts a new key/value pair into this ‘dictionary’. Returns true is successful. Returns false if the key already exists.

Source§

fn remove(&mut self, key: String) -> bool

Removes the specified key, if it exists. Returns true if successful. Returns false if the specified key does not exist.

Source§

fn replace(&mut self, pair: KeyValue<String, V>) -> bool

Replaces the value associated with the specified key with the specified value. Returns true if successful. Returns false if the specified key does not exist.

Source§

impl<V> PartialEq for Dictionary<V>

Source§

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

Returns true if this ‘dictionary’ and the specified ‘dictionary’ are equal, meaning they are the same length and contain the same entries. For ‘dictionaries’, the order of the entries is irrelevant.

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<V> Sortable for Dictionary<V>

Source§

fn is_sorted(&self) -> bool

Returns true if this ‘dictionary’ is sorted in ascending order.

Source§

fn is_sorted_rev(&self) -> bool

Returns true if this ‘dictionary’ is sorted in descending order.

Source§

fn sort(&mut self)

Sorts the elements in this ‘dictionary’ in ascending order.

Source§

fn sort_rev(&mut self)

Sorts the elements in this ‘dictionary’ in descending order.

Auto Trait Implementations§

§

impl<V> Freeze for Dictionary<V>

§

impl<V> RefUnwindSafe for Dictionary<V>
where V: RefUnwindSafe,

§

impl<V> Send for Dictionary<V>
where V: Send,

§

impl<V> Sync for Dictionary<V>
where V: Sync,

§

impl<V> Unpin for Dictionary<V>
where V: Unpin,

§

impl<V> UnwindSafe for Dictionary<V>
where V: 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> ToOwned for T
where T: Clone,

Source§

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