Struct BoolishValueParser
#[non_exhaustive]
pub struct BoolishValueParser {}
Parse bool-like string values
See also:
ValueParser::boolfor different human readable bool representationsFalseyValueParserfor assuming non-false is true
Example
Usage:
# use clap_builder as clap;
let mut cmd = new
.arg;
let m = cmd.try_get_matches_from_mut.unwrap;
let port: bool = *m.get_one
.expect;
assert_eq!;
Semantics:
# use clap_builder as clap;
# use OsStr;
# use TypedValueParser;
# let cmd = new;
# let arg = None;
let value_parser = new;
assert!;
assert!;
assert!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Implementations
impl BoolishValueParser
fn new() -> SelfParse bool-like string values
Trait Implementations
impl Clone for BoolishValueParser
fn clone(&self) -> BoolishValueParser
impl Copy for BoolishValueParser
impl Debug for BoolishValueParser
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for BoolishValueParser
fn default() -> Self
impl TypedValueParser for BoolishValueParser
type Value = bool;fn parse_ref(&self, cmd: &Command, arg: Option<&Arg>, value: &OsStr) -> Result<Self::Value, Error>fn possible_values(&self) -> Option<Box<dyn Iterator<Item = PossibleValue> + '_>>
Auto Trait Implementations
impl Freeze for BoolishValueParser
impl RefUnwindSafe for BoolishValueParser
impl Send for BoolishValueParser
impl Sync for BoolishValueParser
impl Unpin for BoolishValueParser
impl UnsafeUnpin for BoolishValueParser
impl UnwindSafe for BoolishValueParser
Blanket Implementations
impl<I> IntoResettable<ValueParser> for BoolishValueParser
where
I: Into<ValueParser>,
fn into_resettable(self) -> Resettable<ValueParser>
impl<T> Any for BoolishValueParser
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for BoolishValueParser
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for BoolishValueParser
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for BoolishValueParser
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for BoolishValueParser
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for BoolishValueParser
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for BoolishValueParser
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for BoolishValueParser
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for BoolishValueParser
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>