ValueExt

Trait ValueExt 

Source
pub trait ValueExt<'a> {
    // Required methods
    fn path(self) -> Result<&'a Path, LexError<'a>>;
    fn string(self, description: &str) -> Result<&'a str, LexError<'a>>;
    fn one_of(self, possible: &[&str]) -> Result<&'a str, LexError<'a>>;
    fn parse<T: FromStr>(self) -> Result<T, LexError<'a>>
       where T::Err: Display;
    fn try_map<F, T, E>(self, op: F) -> Result<T, LexError<'a>>
       where F: FnOnce(&'a OsStr) -> Result<T, E>,
             E: Display;
}
Expand description

Extensions for parsing Arg::Value

Required Methods§

Source

fn path(self) -> Result<&'a Path, LexError<'a>>

Convert Arg::Value

Source

fn string(self, description: &str) -> Result<&'a str, LexError<'a>>

Convert Arg::Value with a description of the intended format

Source

fn one_of(self, possible: &[&str]) -> Result<&'a str, LexError<'a>>

Ensure Arg::Value is from a closed set of values

Source

fn parse<T: FromStr>(self) -> Result<T, LexError<'a>>
where T::Err: Display,

Parse Arg::Value

Source

fn try_map<F, T, E>(self, op: F) -> Result<T, LexError<'a>>
where F: FnOnce(&'a OsStr) -> Result<T, E>, E: Display,

Custom conversion for Arg::Value

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a> ValueExt<'a> for &'a OsStr

Source§

fn path(self) -> Result<&'a Path, LexError<'a>>

Source§

fn string(self, description: &str) -> Result<&'a str, LexError<'a>>

Source§

fn one_of(self, possible: &[&str]) -> Result<&'a str, LexError<'a>>

Source§

fn parse<T: FromStr>(self) -> Result<T, LexError<'a>>
where T::Err: Display,

Source§

fn try_map<F, T, E>(self, op: F) -> Result<T, LexError<'a>>
where F: FnOnce(&'a OsStr) -> Result<T, E>, E: Display,

Implementors§

Source§

impl<'a> ValueExt<'a> for Result<&'a OsStr, LexError<'a>>