pub struct OptionsDecoder<'dec> { /* private fields */ }
Expand description
Decodes a list of arbitrary arguments into a set of OptionRequest
s.
Takes a set of
Implementations§
Source§impl<'dec> OptionsDecoder<'dec>
impl<'dec> OptionsDecoder<'dec>
Sourcepub fn flag_present(&self, flag: &str) -> Result<bool, OptionsDecoderError>
pub fn flag_present(&self, flag: &str) -> Result<bool, OptionsDecoderError>
Check whether a flag is present
Sourcepub fn get_value<T>(&self, flag: &str) -> Result<Option<T>, OptionsDecoderError>where
T: 'static,
pub fn get_value<T>(&self, flag: &str) -> Result<Option<T>, OptionsDecoderError>where
T: 'static,
Get a value for a flag, if present. Only returns Ok(None) if the option is optional, otherwise an Err() is returned.
Will also return an error if multiple values are defined for this type.
Sourcepub fn get_values<T>(
&self,
flag: &str,
) -> Result<Option<Vec<T>>, OptionsDecoderError>where
T: 'static,
pub fn get_values<T>(
&self,
flag: &str,
) -> Result<Option<Vec<T>>, OptionsDecoderError>where
T: 'static,
Get all values for a flag, if present. Only returns Ok(None) if the option is optional, otherwise an Err() is returned.
Will also return an error if this option does not accept multiple values.
Auto Trait Implementations§
impl<'dec> Freeze for OptionsDecoder<'dec>
impl<'dec> !RefUnwindSafe for OptionsDecoder<'dec>
impl<'dec> !Send for OptionsDecoder<'dec>
impl<'dec> !Sync for OptionsDecoder<'dec>
impl<'dec> Unpin for OptionsDecoder<'dec>
impl<'dec> !UnwindSafe for OptionsDecoder<'dec>
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
Source§impl<T> InstanceOf for T
impl<T> InstanceOf for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more