Skip to main content

Error

Enum Error 

Source
pub enum Error {
    Empty,
    UnknownArch(String),
    UnknownOs(String),
    UnknownEnv(String),
    Trailing(Vec<String>),
    BadVersion {
        component: &'static str,
        found: String,
    },
    SubArchMismatch {
        arch: Arch,
        sub_arch: SubArch,
    },
    EndianUnsupported {
        arch: Arch,
        endian: Endian,
    },
    EnvMismatch {
        os: Os,
        env: Env,
    },
    AbiMismatch {
        arch: Arch,
        abi: Abi,
    },
    VersionNotAccepted {
        component: &'static str,
    },
}
Expand description

A tuple that could not be read, or that was read and does not describe a machine.

Every variant names the component it is unhappy about. That is the whole design goal of this type: the model this replaces had a catch-all arm that skipped anything it did not recognize, so x86_64-linux-gnu.2.28 parsed as x86_64-linux-gnu and the version was thrown away with no diagnostic. A user who pins a glibc version and gets the host’s is not going to find out until the binary fails on the target machine.

Variants§

§

Empty

The tuple was empty or all separators.

§

UnknownArch(String)

The leading component is not an architecture we know.

§

UnknownOs(String)

The OS component is not an OS we know.

§

UnknownEnv(String)

The environment component is not an environment we know.

§

Trailing(Vec<String>)

Components were left over after the environment was read.

This is the case the old catch-all silently ate, so it is an error with the leftovers quoted rather than a shrug.

§

BadVersion

A version was attached to a component and could not be read as one.

Fields

§component: &'static str

The component the version was attached to, for the message.

§found: String

What was found where a version was expected.

§

SubArchMismatch

A sub-architecture was named that does not belong to the architecture.

Fields

§arch: Arch

The architecture that was named.

§sub_arch: SubArch

The baseline that does not belong to it.

§

EndianUnsupported

A byte order was named that the architecture does not have.

Fields

§arch: Arch

The architecture that was named.

§endian: Endian

The byte order it does not have.

§

EnvMismatch

An environment was named that the OS does not have.

Fields

§os: Os

The OS that was named.

§env: Env

The environment it does not have.

§

AbiMismatch

A float ABI was named for an architecture that has one calling convention.

Fields

§arch: Arch

The architecture that was named.

§abi: Abi

The ABI it cannot select.

§

VersionNotAccepted

A version was attached to a component that does not take one.

x86_64-linux.5.15-gnu is not a request for a kernel version, it is a mistake, and accepting it would mean the tuple carries a field nothing reads.

Fields

§component: &'static str

The component the version was attached to.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Eq for Error

Source§

impl Error for Error

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 PartialEq for Error

Source§

fn eq(&self, other: &Error) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe 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
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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.