Struct parkour::Error[][src]

pub struct Error { /* fields omitted */ }

The error type when parsing command-line arguments. You can create an Error by creating an ErrorInner and converting it with .into().

This error type supports an error source for attaching context to the error.

Implementations

impl Error[src]

pub fn with_source(self, source: impl Error + Sync + Send + 'static) -> Self[src]

Attach context to the error.

Usage

use parkour::{Error, util::Flag};

Error::missing_value()
    .with_source(Error::in_subcommand("test"))

This could produce the following output:

missing value
    source: in subcommand `test`

pub fn no_value() -> Self[src]

Create a NoValue error

pub fn is_no_value(&self) -> bool[src]

Returns true if this is a NoValue error

pub fn missing_value() -> Self[src]

Create a MissingValue error

pub fn is_missing_value(&self) -> bool[src]

Returns true if this is a MissingValue error

pub fn early_exit() -> Self[src]

Create a EarlyExit error

pub fn is_early_exit(&self) -> bool[src]

Returns true if this is a EarlyExit error

pub fn unexpected_value(got: impl ToString, expected: impl ToString) -> Self[src]

Create a UnexpectedValue error

pub fn missing_argument(arg: impl ToString) -> Self[src]

Create a MissingArgument error

pub fn in_argument(flag: &Flag<'_>) -> Self[src]

Create a InArgument error

pub fn in_subcommand(cmd: impl ToString) -> Self[src]

Create a InSubcommand error

Trait Implementations

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

impl From<ErrorInner> for Error[src]

impl From<ParseFloatError> for Error[src]

impl From<ParseIntError> for Error[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.