Skip to main content

Error

Trait Error 

Source
pub trait Error {
    type FlagList: FlagsList<'static>;

    // Required methods
    fn required_flag(
        field: &'static str,
        tags: Tags<'static>,
        placeholder: &'static str,
    ) -> Self;
    fn required_positional(
        field: &'static str,
        placeholder: &'static str,
    ) -> Self;
    fn any_required_flag(list: Self::FlagList) -> Self;
    fn flattened(field: &'static str, error: Self) -> Self;
    fn required_subcommand(expected: &'static [&'static str]) -> Self;
    fn custom(message: impl Display) -> Self;
}
Expand description

Errors that can occur while converting the parsed arguments into the final structure. Generally these failures are related to the absence of required arguments; errors that are specific to a particular parameter or incoming argument are handled earlier.

Required Associated Types§

Source

type FlagList: FlagsList<'static>

When reporting any_required_flag, we need to be able to report a list of flags. This type allows the error to define the container it wants to use for those flags.

Required Methods§

Source

fn required_flag( field: &'static str, tags: Tags<'static>, placeholder: &'static str, ) -> Self

A required flag wasn’t present.

Source

fn required_positional(field: &'static str, placeholder: &'static str) -> Self

A required positional field wasn’t present.

Source

fn any_required_flag(list: Self::FlagList) -> Self

At least one of the flags in this list were required.

Source

fn flattened(field: &'static str, error: Self) -> Self

There was an error building a flattened field.

Source

fn required_subcommand(expected: &'static [&'static str]) -> Self

We required a subcommand, but none was provided.

Source

fn custom(message: impl Display) -> Self

Something else went wrong.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§