Enum ming::Error[][src]

pub enum Error {
    MissingValue {
        option: Option<String>,
    },
    UnexpectedOption(String),
    UnexpectedArgument(OsString),
    UnexpectedValue {
        option: Option<String>,
        value: OsString,
    },
    ParsingFailed {
        value: String,
        error: Box<dyn Error + Send + Sync + 'static>,
    },
    NonUnicodeValue(OsString),
    Custom(Box<dyn Error + Send + Sync + 'static>),
}
Expand description

An error during argument parsing.

This implements From<String> and From<&str>, for easy ad-hoc error messages.

It also implements From<OsString>, as that’s used as an error type by OsString::into_string, so that method may be used with the try (?) operator.

Variants

MissingValue

An option argument was expected but was not found.

Show 1 field

Fields of MissingValue

option: Option<String>

The most recently emitted option.

UnexpectedOption(String)

An unexpected option was found.

UnexpectedArgument(OsString)

A positional argument was found when none was expected.

UnexpectedValue

An option had a value when none was expected.

Show 2 fields

Fields of UnexpectedValue

option: Option<String>

The option. This is always a long option.

value: OsString

The value.

ParsingFailed

Parsing a value failed. Returned by methods on ValueExt.

Show 2 fields

Fields of ParsingFailed

value: String

The string that failed to parse.

error: Box<dyn Error + Send + Sync + 'static>

The error returned while parsing.

NonUnicodeValue(OsString)

A value was found that was not valid unicode.

This can be returned by some methods on ValueExt.

Custom(Box<dyn Error + Send + Sync + 'static>)

For custom error messages in application code.

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.