pub trait Extend<'a> {
// Required method
fn extend(&self, first: &'a str, rest: &'a [&'a str]) -> Vec<Value<'a>>;
}Expand description
Helpers to extend a parsed Value path with additional string arguments.
This trait is used by the command dispatch code to build a Vec<Value>
representing the command path plus the user provided arguments. For
example, it allows turning [] into [Value::String("help")] or to
append further tokens.
Required Methods§
Sourcefn extend(&self, first: &'a str, rest: &'a [&'a str]) -> Vec<Value<'a>>
fn extend(&self, first: &'a str, rest: &'a [&'a str]) -> Vec<Value<'a>>
Extend the current slice of parsed Values with additional string
arguments and return a new Vec<Value>.
This is used by the command dispatch code to create a concrete
argument vector that contains the existing parsed values followed by
the provided first argument and any rest arguments. The returned
vector contains cloned/copy variants of the original Values.
§Arguments
self- The slice of already-parsedValuearguments to extend.first- The first additional argument to append (becomes aValue::String).rest- Remaining additional arguments to append (each becomes aValue::String).
§Returns
A newly allocated Vec<Value<'a>> containing the original values (as
copies) followed by first and the elements of rest converted to
Value::String.