Struct nu_protocol::value::dict::TaggedDictBuilder
source · [−]pub struct TaggedDictBuilder { /* private fields */ }
Expand description
A helper to help create dictionaries for you. It has the ability to insert values into the dictionary while maintaining the tags that need to be applied to the individual members
Implementations
sourceimpl TaggedDictBuilder
impl TaggedDictBuilder
sourcepub fn new(tag: impl Into<Tag>) -> TaggedDictBuilder
pub fn new(tag: impl Into<Tag>) -> TaggedDictBuilder
Create a new builder
sourcepub fn build(
tag: impl Into<Tag>,
block: impl FnOnce(&mut TaggedDictBuilder)
) -> Value
pub fn build(
tag: impl Into<Tag>,
block: impl FnOnce(&mut TaggedDictBuilder)
) -> Value
Build the contents of the builder into a Value
sourcepub fn with_capacity(tag: impl Into<Tag>, n: usize) -> TaggedDictBuilder
pub fn with_capacity(tag: impl Into<Tag>, n: usize) -> TaggedDictBuilder
Create a new builder with a pre-defined capacity
sourcepub fn insert_untagged(
&mut self,
key: impl Into<String>,
value: impl Into<UntaggedValue>
)
pub fn insert_untagged(
&mut self,
key: impl Into<String>,
value: impl Into<UntaggedValue>
)
Insert an untagged key/value pair into the dictionary, to later be tagged when built
sourcepub fn insert_value(&mut self, key: impl Into<String>, value: impl Into<Value>)
pub fn insert_value(&mut self, key: impl Into<String>, value: impl Into<Value>)
Insert a key/value pair into the dictionary
sourcepub fn into_value(self) -> Value
pub fn into_value(self) -> Value
Convert the dictionary into a tagged Value using the original tag
sourcepub fn into_untagged_value(self) -> UntaggedValue
pub fn into_untagged_value(self) -> UntaggedValue
Convert the dictionary into an UntaggedValue
sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Checks if given key exists
Trait Implementations
sourceimpl Clone for TaggedDictBuilder
impl Clone for TaggedDictBuilder
sourcefn clone(&self) -> TaggedDictBuilder
fn clone(&self) -> TaggedDictBuilder
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 TaggedDictBuilder
impl Debug for TaggedDictBuilder
sourceimpl From<TaggedDictBuilder> for Value
impl From<TaggedDictBuilder> for Value
sourcefn from(input: TaggedDictBuilder) -> Value
fn from(input: TaggedDictBuilder) -> Value
Convert a builder into a tagged Value
Auto Trait Implementations
impl RefUnwindSafe for TaggedDictBuilder
impl Send for TaggedDictBuilder
impl Sync for TaggedDictBuilder
impl Unpin for TaggedDictBuilder
impl UnwindSafe for TaggedDictBuilder
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<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