pub trait FromArg: Sized {
// Required method
fn from_arg(raw: &str) -> Result<Self, String>;
// Provided method
fn type_name() -> &'static str { ... }
}Expand description
Convert a raw command-line argument string into a typed value.
A blanket implementation covers every T: FromStr with a Display error,
so any type that already implements FromStr works automatically. Implement
this trait directly only for types that cannot use FromStr (for example,
to support a custom syntax).
Required Methods§
Provided Methods§
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.