pub enum ParsedValue {
Single(String),
Multiple(Vec<String>),
Count(usize),
Flag(bool),
Unset,
FlagNeedsValue,
}Expand description
A parsed value from the command line.
Variants§
Single(String)
A single string value.
Multiple(Vec<String>)
Multiple string values (for append or multi-valued options).
Count(usize)
A count of occurrences.
Flag(bool)
A boolean flag value.
Unset
Value was not set (placeholder for missing optional values).
FlagNeedsValue
Option was used as a flag without providing a value.
This happens when an optional-value option (like --opt) is used
without a value and the next token looks like another option.
The command layer should handle this by prompting or using a flag_value.
Implementations§
Source§impl ParsedValue
impl ParsedValue
Sourcepub fn as_multiple(&self) -> Option<&[String]>
pub fn as_multiple(&self) -> Option<&[String]>
Get as multiple strings, if applicable.
Trait Implementations§
Source§impl Clone for ParsedValue
impl Clone for ParsedValue
Source§fn clone(&self) -> ParsedValue
fn clone(&self) -> ParsedValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParsedValue
impl Debug for ParsedValue
Source§impl PartialEq for ParsedValue
impl PartialEq for ParsedValue
Source§fn eq(&self, other: &ParsedValue) -> bool
fn eq(&self, other: &ParsedValue) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ParsedValue
Auto Trait Implementations§
impl Freeze for ParsedValue
impl RefUnwindSafe for ParsedValue
impl Send for ParsedValue
impl Sync for ParsedValue
impl Unpin for ParsedValue
impl UnsafeUnpin for ParsedValue
impl UnwindSafe for ParsedValue
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
Mutably borrows from an owned value. Read more