Skip to main content

FromArgValue

Trait FromArgValue 

Source
pub trait FromArgValue: Sized {
    // Required method
    fn from_arg_value(value: &str) -> Result<Self, String>;
}
Expand description

Types which can be constructed from a single commandline value.

Any field type declared in a struct that derives FromArgs must implement this trait. A blanket implementation exists for types implementing FromStr<Error: Display>. Custom types can implement this trait directly. It can also be derived on plain enums without associated data.

Required Methods§

Source

fn from_arg_value(value: &str) -> Result<Self, String>

Construct the type from a commandline value, returning an error string on failure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> FromArgValue for T
where T: FromStr, T::Err: Display,