Trait ParseArgFromStr

Source
pub trait ParseArgFromStr: FromStr
where Self::Err: Display,
{ // Required method fn describe_type<W>(writer: W) -> Result<(), Error> where W: Write; }
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>(writer: W) -> Result<(), Error>
where W: Write,

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>(writer: W) -> Result<(), Error>
where W: Write,

Source§

impl ParseArgFromStr for SocketAddr

Source§

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

Source§

impl ParseArgFromStr for bool

Source§

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

Source§

impl ParseArgFromStr for char

Source§

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

Source§

impl ParseArgFromStr for f32

Source§

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

Source§

impl ParseArgFromStr for f64

Source§

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

Source§

impl ParseArgFromStr for i8

Source§

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

Source§

impl ParseArgFromStr for i16

Source§

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

Source§

impl ParseArgFromStr for i32

Source§

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

Source§

impl ParseArgFromStr for i64

Source§

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

Source§

impl ParseArgFromStr for i128

Source§

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

Source§

impl ParseArgFromStr for isize

Source§

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

Source§

impl ParseArgFromStr for u8

Source§

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

Source§

impl ParseArgFromStr for u16

Source§

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

Source§

impl ParseArgFromStr for u32

Source§

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

Source§

impl ParseArgFromStr for u64

Source§

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

Source§

impl ParseArgFromStr for u128

Source§

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

Source§

impl ParseArgFromStr for usize

Source§

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

Source§

impl ParseArgFromStr for Ipv4Addr

Source§

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

Source§

impl ParseArgFromStr for Ipv6Addr

Source§

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

Source§

impl ParseArgFromStr for SocketAddrV4

Source§

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

Source§

impl ParseArgFromStr for SocketAddrV6

Source§

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

Source§

impl ParseArgFromStr for NonZero<i8>

Source§

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

Source§

impl ParseArgFromStr for NonZero<i16>

Source§

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

Source§

impl ParseArgFromStr for NonZero<i32>

Source§

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

Source§

impl ParseArgFromStr for NonZero<i64>

Source§

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

Source§

impl ParseArgFromStr for NonZero<i128>

Source§

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

Source§

impl ParseArgFromStr for NonZero<isize>

Source§

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

Source§

impl ParseArgFromStr for NonZero<u8>

Source§

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

Source§

impl ParseArgFromStr for NonZero<u16>

Source§

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

Source§

impl ParseArgFromStr for NonZero<u32>

Source§

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

Source§

impl ParseArgFromStr for NonZero<u64>

Source§

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

Source§

impl ParseArgFromStr for NonZero<u128>

Source§

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

Source§

impl ParseArgFromStr for NonZero<usize>

Source§

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

Implementors§