Trait nameless_clap::TryFromOsArg[][src]

pub trait TryFromOsArg: Sized {
    type Error;
    fn try_from_os_str_arg(os: &OsStr) -> Result<Self, Self::Error>;

    fn try_from_os_string_arg(os: OsString) -> Result<Self, Self::Error> { ... }
}

Parse a value from an OsString, possibly with side effects.

This is intended to be used with OsString values returned from ArgsOs as part of command-line parsing which typically happens at most once per process. Unlike FromStr, From, or TryFrom, it may have side effects such as opening files or network connections.

Associated Types

type Error[src]

The associated error which can be returned from parsing.

Loading content...

Required methods

fn try_from_os_str_arg(os: &OsStr) -> Result<Self, Self::Error>[src]

Parses an OS string os to return a value of this type, with side effects appropriate to converting command-line strings into resource handles.

If parsing succeeds, return the value inside Ok, otherwise when the string is ill-formatted return an error specific to the inside Err. The error type is specific to implementation of the trait.

Loading content...

Provided methods

fn try_from_os_string_arg(os: OsString) -> Result<Self, Self::Error>[src]

Like try_from_os_str_arg, but takes an OsString instead. Types should manually implement this if they can reuse an existing OsString allocation.

Loading content...

Implementors

Loading content...