[][src]Struct nu_protocol::value::dict::Dictionary

pub struct Dictionary {
    pub entries: IndexMap<String, Value>,
}

A dictionary that can hold a mapping from names to Values

Fields

entries: IndexMap<String, Value>

Implementations

impl Dictionary[src]

pub fn entries(&self) -> &IndexMap<String, Value>[src]

impl Dictionary[src]

pub fn new(entries: IndexMap<String, Value>) -> Self[src]

Constructs a new Dictionary.

impl Dictionary[src]

pub fn get_data(&self, desc: &str) -> MaybeOwned<'_, Value>[src]

Find the matching Value for a given key, if possible. If not, return a Primitive::Nothing

pub fn insert(&mut self, key: String, value: Value) -> Option<Value>[src]

pub fn merge_from(&self, other: &Dictionary) -> Dictionary[src]

pub fn keys(&self) -> impl Iterator<Item = &String>[src]

Iterate the keys in the Dictionary

pub fn values(&self) -> impl Iterator<Item = &Value>[src]

Iterate the values in the Dictionary

pub fn contains_key(&self, key: &str) -> bool[src]

Checks if given key exists

pub fn get_data_by_key(&self, name: Spanned<&str>) -> Option<Value>[src]

Find the matching Value for a key, if possible

pub fn get_mut_data_by_key(&mut self, name: &str) -> Option<&mut Value>[src]

Get a mutable entry that matches a key, if possible

pub fn insert_data_at_key(&mut self, name: &str, value: Value)[src]

Insert a new key/value pair into the dictionary

pub fn length(&self) -> usize[src]

Return size of dictionary

Trait Implementations

impl Clone for Dictionary[src]

impl Debug for Dictionary[src]

impl Default for Dictionary[src]

impl<'de> Deserialize<'de> for Dictionary[src]

impl Eq for Dictionary[src]

impl From<IndexMap<String, Value, RandomState>> for Dictionary[src]

pub fn from(input: IndexMap<String, Value>) -> Dictionary[src]

Create a dictionary from a map of strings to Values

impl Hash for Dictionary[src]

pub fn hash<H: Hasher>(&self, state: &mut H)[src]

Create the hash function to allow the Hash trait for dictionaries

impl Ord for Dictionary[src]

pub fn cmp(&self, other: &Dictionary) -> Ordering[src]

Compare two dictionaries for ordering

impl PartialEq<Dictionary> for Dictionary[src]

impl PartialEq<Value> for Dictionary[src]

pub fn eq(&self, other: &Value) -> bool[src]

Test a dictionary against a Value for equality

impl PartialOrd<Dictionary> for Dictionary[src]

pub fn partial_cmp(&self, other: &Dictionary) -> Option<Ordering>[src]

Compare two dictionaries for sort ordering

impl PrettyDebug for Dictionary[src]

pub fn pretty(&self) -> DebugDocBuilder[src]

Get a Dictionary ready to be pretty-printed

impl Serialize for Dictionary[src]

impl StructuralEq for Dictionary[src]

impl StructuralPartialEq for Dictionary[src]

impl<'a> TryFrom<&'a Value> for &'a Dictionary[src]

type Error = ShellError

The type returned in the event of a conversion error.

pub fn try_from(value: &'a Value) -> Result<&'a Dictionary, ShellError>[src]

Convert to a dictionary, if possible

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> PrettyDebugWithSource for T where
    T: PrettyDebug
[src]

impl<T> SpannedItem for T[src]

impl<T> TaggedItem for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.