Struct nu_protocol::EvaluatedArgs
source · [−]pub struct EvaluatedArgs {
pub positional: Option<Vec<Value>>,
pub named: Option<IndexMap<String, Value>>,
}
Expand description
The set of positional and named arguments, after their values have been evaluated.
- Positional arguments are those who are given as values, without any associated flag. For example, in
foo arg1 arg2
, botharg1
andarg2
are positional arguments. - Named arguments are those associated with a flag. For example,
foo --given bar
the named argument would be namegiven
and the valuebar
.
Fields
positional: Option<Vec<Value>>
named: Option<IndexMap<String, Value>>
Implementations
sourceimpl EvaluatedArgs
impl EvaluatedArgs
sourceimpl EvaluatedArgs
impl EvaluatedArgs
sourcepub fn slice_from(&self, from: usize) -> Vec<Value>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn slice_from(&self, from: usize) -> Vec<Value>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Retrieve a subset of positional arguments starting at a given position
sourcepub fn expect_nth(&self, pos: usize) -> Result<&Value, ShellError>
pub fn expect_nth(&self, pos: usize) -> Result<&Value, ShellError>
Get the nth positional argument, error if not possible
sourcepub fn has(&self, name: &str) -> bool
pub fn has(&self, name: &str) -> bool
Return true if the set of named arguments contains the name provided
sourcepub fn get(&self, name: &str) -> Option<&Value>
pub fn get(&self, name: &str) -> Option<&Value>
Gets the corresponding Value for the named argument given, if possible
sourcepub fn expect_get(&self, name: &str) -> Result<&Value, ShellError>
pub fn expect_get(&self, name: &str) -> Result<&Value, ShellError>
Gets the corresponding Value for the named argument given, error if not possible
sourcepub fn positional_iter(&self) -> PositionalIter<'_>
pub fn positional_iter(&self) -> PositionalIter<'_>
Iterates over the positional arguments
Trait Implementations
sourceimpl Clone for EvaluatedArgs
impl Clone for EvaluatedArgs
sourcefn clone(&self) -> EvaluatedArgs
fn clone(&self) -> EvaluatedArgs
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 EvaluatedArgs
impl Debug for EvaluatedArgs
sourceimpl Default for EvaluatedArgs
impl Default for EvaluatedArgs
sourcefn default() -> EvaluatedArgs
fn default() -> EvaluatedArgs
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for EvaluatedArgs
impl<'de> Deserialize<'de> for EvaluatedArgs
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 Serialize for EvaluatedArgs
impl Serialize for EvaluatedArgs
Auto Trait Implementations
impl RefUnwindSafe for EvaluatedArgs
impl Send for EvaluatedArgs
impl Sync for EvaluatedArgs
impl Unpin for EvaluatedArgs
impl UnwindSafe for EvaluatedArgs
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