Skip to main content

Error

Enum Error 

pub enum Error {
    Io {
        path: PathBuf,
        source: Error,
    },
    Pragma {
        path: PathBuf,
        label: String,
        detail: String,
    },
    Drift {
        path: PathBuf,
        line: usize,
        expected: String,
        actual: String,
    },
    Unclassifiable {
        generator: &'static str,
        detail: String,
    },
    Manifest {
        path: PathBuf,
        detail: String,
    },
    Arm {
        origin: String,
        detail: String,
    },
    Parity(Box<ParityMismatch>),
}
Expand description

Everything the generators can fail with.

Variants§

§

Io

A file could not be read or written.

Fields

§path: PathBuf

The path, relative to the repository root where possible.

§source: Error

The underlying filesystem error.

§

Pragma

A page is missing one of its auto-generated pragmas, or carries it twice.

The generator writes only between the pragmas, so a page whose framing does not delimit a region has no place for the output and is an error rather than an opportunity to append one.

Fields

§path: PathBuf

The page, relative to the repository root.

§label: String

The pragma label the generator looked for.

§detail: String

What was wrong.

§

Drift

A page on disk does not match what the generator would write.

This is --mode check’s only failure, and the message names the file, the first differing line and both versions of it.

Fields

§path: PathBuf

The page, relative to the repository root.

§line: usize

The 1-based line number of the first difference.

§expected: String

The line the generator would write.

§actual: String

The line that is on disk.

§

Unclassifiable

A generator could not determine the truth about its input.

The fail-closed variant: an unparsable manifest, an enum variant whose message the generator cannot read, a value it has no rule for. It never degrades to a placeholder.

Fields

§generator: &'static str

Which generator refused.

§detail: String

What it could not classify, and what to do about it.

§

Manifest

examples/parity.toml does not describe the examples that exist.

Every rejection of the grammar (docs/design/11-documentation-plan.md §17.5) lands here: a duplicate name, a file that is named but absent, a params-only entry missing its tolerance or reason, an unpaired entry with no reason, and — the rule that makes silent exclusion impossible — an example file that appears in no entry at all.

Fields

§path: PathBuf

The manifest, relative to the repository root.

§detail: String

What is wrong, and what to write instead.

§

Arm

One arm of a parity pair could not be run, or printed no parity block.

Kept separate from Error::Parity because the two mean different things: this is “the example did not produce a comparable answer”, which is a broken example (or a missing wheel), while a mismatch is two working examples that disagree.

Fields

§origin: String

Which arm, spelled as the command that runs it.

§detail: String

What went wrong, and what to do about it.

§

Parity(Box<ParityMismatch>)

Two parity blocks disagree on a field.

Boxed because it is by far the largest variant — seven owned strings — and an unboxed one makes every Result in this crate wide enough to trip clippy::result_large_err on functions that can never return it.

Implementations§

§

impl Error

pub fn io(path: impl Into<PathBuf>, source: Error) -> Self

Wraps a filesystem error with the path it happened on.

pub fn unclassifiable( generator: &'static str, detail: impl Into<String>, ) -> Self

Reports an input a generator has no rule for.

pub fn manifest(path: impl Into<PathBuf>, detail: impl Into<String>) -> Self

Reports a manifest that does not describe the examples on disk.

pub fn arm(origin: impl Into<String>, detail: impl Into<String>) -> Self

Reports an arm that did not produce a comparable answer.

Trait Implementations§

§

impl Debug for Error

§

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

Formats the value using the given formatter. Read more
§

impl Display for Error

§

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

Formats the value using the given formatter. Read more
§

impl Error for Error

§

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

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

§

fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>

Fallible version of [ToCompactString::to_compact_string()] Read more
§

fn to_compact_string(&self) -> CompactString

Converts the given value to a [CompactString]. Read more
§

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

§

fn to_line(&self) -> Line<'_>

Converts the value to a [Line].
§

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

§

fn to_span(&self) -> Span<'_>

Converts the value to a [Span].
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
§

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

§

fn to_text(&self) -> Text<'_>

Converts the value to a [Text].
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.
§

impl<T> Ungil for T
where T: Send,

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more