Struct nu_protocol::value::dict::Dictionary
source · [−]Expand description
A dictionary that can hold a mapping from names to Values
Fields
entries: IndexMap<String, Value>
Implementations
sourceimpl Dictionary
impl Dictionary
sourceimpl Dictionary
impl Dictionary
sourcepub fn get_data(&self, desc: &str) -> MaybeOwned<'_, Value>
pub fn get_data(&self, desc: &str) -> MaybeOwned<'_, Value>
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>
pub fn merge_from(&self, other: &Dictionary) -> Dictionary
sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Checks if given key exists
sourcepub fn get_data_by_key(&self, name: Spanned<&str>) -> Option<Value>
pub fn get_data_by_key(&self, name: Spanned<&str>) -> Option<Value>
Find the matching Value for a key, if possible
sourcepub fn get_mut_data_by_key(&mut self, name: &str) -> Option<&mut Value>
pub fn get_mut_data_by_key(&mut self, name: &str) -> Option<&mut Value>
Get a mutable entry that matches a key, if possible
sourcepub fn insert_data_at_key(&mut self, name: &str, value: Value)
pub fn insert_data_at_key(&mut self, name: &str, value: Value)
Insert a new key/value pair into the dictionary
Trait Implementations
sourceimpl Clone for Dictionary
impl Clone for Dictionary
sourcefn clone(&self) -> Dictionary
fn clone(&self) -> Dictionary
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Dictionary
impl Debug for Dictionary
sourceimpl Default for Dictionary
impl Default for Dictionary
sourcefn default() -> Dictionary
fn default() -> Dictionary
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for Dictionary
impl<'de> Deserialize<'de> for Dictionary
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<IndexMap<String, Value, RandomState>> for Dictionary
impl From<IndexMap<String, Value, RandomState>> for Dictionary
sourceimpl Hash for Dictionary
impl Hash for Dictionary
sourceimpl Ord for Dictionary
impl Ord for Dictionary
sourcefn cmp(&self, other: &Dictionary) -> Ordering
fn cmp(&self, other: &Dictionary) -> Ordering
Compare two dictionaries for ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
sourceimpl PartialEq<Dictionary> for Dictionary
impl PartialEq<Dictionary> for Dictionary
sourcefn eq(&self, other: &Dictionary) -> bool
fn eq(&self, other: &Dictionary) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Dictionary) -> bool
fn ne(&self, other: &Dictionary) -> bool
This method tests for !=
.
sourceimpl PartialEq<Value> for Dictionary
impl PartialEq<Value> for Dictionary
sourceimpl PartialOrd<Dictionary> for Dictionary
impl PartialOrd<Dictionary> for Dictionary
sourcefn partial_cmp(&self, other: &Dictionary) -> Option<Ordering>
fn partial_cmp(&self, other: &Dictionary) -> Option<Ordering>
Compare two dictionaries for sort ordering
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PrettyDebug for Dictionary
impl PrettyDebug for Dictionary
sourcefn pretty(&self) -> DebugDocBuilder
fn pretty(&self) -> DebugDocBuilder
Get a Dictionary ready to be pretty-printed
fn to_doc(&self) -> DebugDoc
fn pretty_doc(
&self
) -> Doc<'static, BoxDoc<'static, ShellAnnotation>, ShellAnnotation>
fn pretty_builder(&self) -> DocBuilder<'static, BoxAllocator, ShellAnnotation>
sourcefn display(&self) -> String
fn display(&self) -> String
A convenience method that prints out the document without colors in 70 columns. Generally, you should use plain_string or colored_string if possible, but display() can be useful for trace lines and things like that, where you don’t have control over the terminal. Read more
fn plain_string(&self, width: usize) -> String
fn colored_string(&self, width: usize) -> String
sourceimpl Serialize for Dictionary
impl Serialize for Dictionary
sourceimpl<'a> TryFrom<&'a Value> for &'a Dictionary
impl<'a> TryFrom<&'a Value> for &'a Dictionary
sourcefn try_from(value: &'a Value) -> Result<&'a Dictionary, ShellError>
fn try_from(value: &'a Value) -> Result<&'a Dictionary, ShellError>
Convert to a dictionary, if possible
type Error = ShellError
type Error = ShellError
The type returned in the event of a conversion error.
impl Eq for Dictionary
impl StructuralEq for Dictionary
impl StructuralPartialEq for Dictionary
Auto Trait Implementations
impl RefUnwindSafe for Dictionary
impl Send for Dictionary
impl Sync for Dictionary
impl Unpin for Dictionary
impl UnwindSafe for Dictionary
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> PrettyDebugWithSource for T where
T: PrettyDebug,
impl<T> PrettyDebugWithSource for T where
T: PrettyDebug,
pub fn pretty_debug(&self, _source: &str) -> DebugDocBuilder
fn refined_pretty_debug(
&self,
_refine: PrettyDebugRefineKind,
source: &str
) -> DebugDocBuilder
fn debug(&self, source: impl Into<Text>) -> String where
Self: Clone,
fn debuggable(self, source: impl Into<Text>) -> DebuggableWithSource<Self>
sourceimpl<T> SpannedItem for T
impl<T> SpannedItem for T
sourceimpl<T> TaggedItem for T
impl<T> TaggedItem for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more