pub enum ArgumentValue {
Scalar(String),
List(Vec<String>),
}Expand description
One value supplied for a declared parameter.
Two shapes, because a command’s parameters have two shapes: a single value becomes one argv element, and a list becomes one element per item in the operand that carries it. Nothing here joins a list into a string — joining exists only to survive a re-split, and no re-split happens.
Variants§
Scalar(String)
A single value, rendered as written.
List(Vec<String>)
A list of values, one argv element each.
Implementations§
Source§impl ArgumentValue
impl ArgumentValue
Sourcepub fn describe(&self) -> String
pub fn describe(&self) -> String
How a diagnostic names this value, without pretending a list is a string.
Sourcepub fn from_json(parameter: &str, value: &Value) -> Result<Self, RenderError>
pub fn from_json(parameter: &str, value: &Value) -> Result<Self, RenderError>
The argument value a JSON dispatch input carries for parameter.
Strings, numbers and booleans have one obvious argument spelling and
take it. An array becomes a list, provided every item is itself one of
those three. null and an object have no single obvious spelling —
guessing one (empty string? JSON text? space-joined?) would make the
command mean something the author never wrote — so each is refused by
name.
§Errors
Returns RenderError::UnrepresentableValue for a value with no
unambiguous argument form, and RenderError::InteriorNul for a
string carrying a NUL byte, which the kernel would silently truncate
the argument at.
Trait Implementations§
Source§impl Clone for ArgumentValue
impl Clone for ArgumentValue
Source§fn clone(&self) -> ArgumentValue
fn clone(&self) -> ArgumentValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ArgumentValue
impl Debug for ArgumentValue
impl Eq for ArgumentValue
Source§impl PartialEq for ArgumentValue
impl PartialEq for ArgumentValue
impl StructuralPartialEq for ArgumentValue
Auto Trait Implementations§
impl Freeze for ArgumentValue
impl RefUnwindSafe for ArgumentValue
impl Send for ArgumentValue
impl Sync for ArgumentValue
impl Unpin for ArgumentValue
impl UnsafeUnpin for ArgumentValue
impl UnwindSafe for ArgumentValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.