[−][src]Enum docopt::Value
A matched command line value.
The value can be a boolean, counted repetition, a plain string or a list of strings.
The various as_{bool,count,str,vec} methods provide convenient access
to values without destructuring manually.
Variants
Switch(bool)A boolean value from a flag that has no argument.
The presence of a flag means true and the absence of a flag
means false.
Counted(u64)The number of occurrences of a repeated flag.
A positional or flag argument.
This is None when the positional argument or flag is not present.
Note that it is possible to have Some("") for a present but empty
argument.
A List of positional or flag arguments.
This list may be empty when no arguments or flags are present.
Methods
impl Value[src]
pub fn as_bool(&self) -> bool[src]
Returns the value as a bool.
Counted repetitions are false if 0 and true otherwise.
Plain strings are true if present and false otherwise.
Lists are true if non-empty and false otherwise.
pub fn as_count(&self) -> u64[src]
Returns the value as a count of the number of times it occurred.
Booleans are 1 if true and 0 otherwise.
Plain strings are 1 if present and 0 otherwise.
Lists correspond to its length.
pub fn as_str(&self) -> &str[src]
Returns the value as a string.
All values return an empty string except for a non-empty plain string.
pub fn as_vec(&self) -> Vec<&str>[src]
Returns the value as a list of strings.
Booleans, repetitions and empty strings correspond to an empty list.
Plain strings correspond to a list of length 1.
Trait Implementations
impl Clone for Value[src]
impl PartialEq<Value> for Value[src]
impl Debug for Value[src]
impl StructuralPartialEq for Value[src]
Auto Trait Implementations
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
impl RefUnwindSafe for Value
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,