ParseArgFromStr

Trait ParseArgFromStr 

Source
pub trait ParseArgFromStr: FromStr
where <Self as FromStr>::Err: Display,
{ // Required method fn describe_type<W: Write>(writer: W) -> Result; }
Expand description

Shorthand for implementing ParseArg for types that already implement FromStr.

This trait allows to implement ParseArg cheaply, just by providing the description. Prefer this approach if your type already impls FromStr without copying the string. In case the implementation can be made more performant by directly implementing ParseArg, prefer direct implementation. (This is what String does for example.)

This trait should only be implemented - do not use it as a bound! Use ParseArg as a bound because it is more general and provides same features.

Required Methods§

Source

fn describe_type<W: Write>(writer: W) -> Result

Writes human-readable description of the type to the writer.

For full information, read the documentation for ParseArgs::describe_type.

ParseArgs::describe_type is delegated to this method when ParseArgFromStr is implemented.

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 ParseArgFromStr for IpAddr

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for SocketAddr

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for bool

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for char

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for f32

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for f64

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for i8

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for i16

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for i32

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for i64

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for i128

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for isize

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for u8

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for u16

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for u32

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for u64

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for u128

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for usize

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for Ipv4Addr

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for Ipv6Addr

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for SocketAddrV4

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for SocketAddrV6

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroI8

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroI16

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroI32

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroI64

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroI128

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroIsize

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroU8

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroU16

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroU32

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroU64

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroU128

Source§

fn describe_type<W: Write>(writer: W) -> Result

Source§

impl ParseArgFromStr for NonZeroUsize

Source§

fn describe_type<W: Write>(writer: W) -> Result

Implementors§