EmptyError

Struct EmptyError 

Source
pub struct EmptyError;
Expand description

A simple argument parsing error type that contains no data. Mostly used for testing and code examples.

Trait Implementations§

Source§

impl Clone for EmptyError

Source§

fn clone(&self) -> EmptyError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EmptyError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EmptyError

Source§

fn default() -> EmptyError

Returns the “default value” for a type. Read more
Source§

impl Display for EmptyError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'arg> Error<'arg> for EmptyError

Source§

fn needs_arg() -> Self

The parameter requires an argument, and none was provided.
Source§

fn got_arg(_: &'arg Arg) -> Self

The parameter is a --switch; it must NOT have a value, and got one.
Source§

fn got_additional_instance() -> Self

The argument appeared more times than expected (usually more than once) on the command line
Source§

fn invalid_utf8(_: &'arg Arg) -> Self

The argument wasn’t valid UTF-8 and should be.
Source§

fn parse_error(_: &str, _: impl Display) -> Self

The argument was valid UTF-8, but it failed to parse into an instance of the type.
Source§

fn byte_parse_error(_: &'arg Arg, _: impl Display) -> Self

The argument failed to parse into an instance of the type.
Source§

fn should_be(_: &'arg Arg, _: &'static [&'static str]) -> Self

The argument should be one of the given values (or, possibly, a case insensitive variation)
Source§

fn custom(_: impl Display) -> Self

Something else went wrong
Source§

impl<'arg> Error<'arg> for EmptyError

Source§

type StateError<A> = EmptyError

Source§

fn positional(_: &'arg Arg, _: Self) -> Self

There was an error handling a positional argument
Source§

fn long_with_argument(_: &'arg Arg, _: &'arg Arg, _: Self) -> Self

There was an error handling a --long=argument argument
Source§

fn long<A>(_: &'arg Arg, _: Self) -> Self

There was an error handling a --long long argument
Source§

fn short<A>(_: u8, _: Self) -> Self

There was an error handling a -s short argument
Source§

fn and(self, _: Self) -> Self

There were multiple argument errors
Source§

impl<'arg, A> Error<'arg, A> for EmptyError

Source§

type ParameterError = EmptyError

Error type for parameter errors (see parameter).
Source§

type FlagList = EmptyError

List of flags for conflicts_with_flags.
Source§

fn parameter(_: &'static str, _: Self::ParameterError) -> Self

A parameter type returned an error. This means that the argument was recognized and matched to a specific field, but something went wrong during parsing, such as a letter appearing in a numeric parameter.
Source§

fn unrecognized(_: A) -> Self

An argument was unrecognized. In this case, the Argument can be returned unused inside of Self, so that it can be retried by a different parser. For instance, a subcommand parser could indicate that an argument is unrecognized, and that argument can later be handled as a global argument.
Source§

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

There was a state error from another State inside of this one.
Source§

fn unknown_subcommand(_: &'static [&'static str]) -> Self

The positional argument was interpreted as a subcommand, but wasn’t recognized as a known subcommand. The list of known subcommands is given.
Source§

fn wrong_subcommand_for_argument(_: &str, _: &[&'static str]) -> Self

The option was recognized, but it isn’t a valid for this particular subcommand. The current subcommand, along with the list of subcommands that accept this option, are given
Source§

fn conflicts_with_flags(_flags: Self::FlagList) -> Self

The argument conflicts with the given flags that were already parsed.
Source§

fn help_requested(_: HelpRequest) -> Self

This was a request for a usage message. This error doesn’t need to interrupt argument parsing, since it can be useful to have a complete state object to print more contextually useful usage messages.
Source§

impl Error for EmptyError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl Error for EmptyError

Source§

type FlagList = EmptyError

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.
Source§

fn required_flag(_: &'static str, _: Tags<'static>, _: &'static str) -> Self

A required flag wasn’t present.
Source§

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

A required positional field wasn’t present.
Source§

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

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

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

There was an error building a flattened field.
Source§

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

We required a subcommand, but none was provided.
Source§

fn custom(_: impl Display) -> Self

Something else went wrong.
Source§

impl<'a> FlagsList<'a> for EmptyError

Source§

fn new(_: Tags<'a>, _: &'a str) -> Self

Create a new FlagsList. Flags lists are guaranteed to include at least one flag, so this constructor includes that flag.
Source§

fn add(&mut self, _: Tags<'a>, _: &'a str)

Insert an additional flag into this set.
Source§

impl Copy for EmptyError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Indentable for T
where T: Display,

Source§

fn indented(self, indent: &str) -> Indented<'_, Self>

Wrap this object so that its Display representation is indented with the given indent. Each non-empty line of the formatted output will be prefixed with the indent. Read more
Source§

fn indented_skip_initial(self, indent: &str) -> IndentedSkipIntial<'_, Self>

Wrap this object so that its Display representation is indented with the given indent. Each non-empty line except for the first of the formatted output will be prefixed with the indent. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.