Trait OptionalArg

Source
pub trait OptionalArg: Sized {
    // Required methods
    fn parse(arg: impl AsRef<str>, arg: ArgRef) -> Result<Self, Error>;
    fn default() -> Self;

    // Provided method
    fn map_parse(
        val: Option<impl AsRef<str>>,
        arg: ArgRef,
    ) -> Result<Self, Error> { ... }
}

Required Methods§

Source

fn parse(arg: impl AsRef<str>, arg: ArgRef) -> Result<Self, Error>

Source

fn default() -> Self

Provided Methods§

Source

fn map_parse(val: Option<impl AsRef<str>>, arg: ArgRef) -> Result<Self, Error>

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<T: Argument> OptionalArg for Option<T>

Source§

fn parse(val: impl AsRef<str>, arg: ArgRef) -> Result<Self, Error>

Source§

fn default() -> Self

Implementors§