Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 47 variants Magic, VersionMajor(u16), VersionMinor(u16), HeaderTruncated, HeaderSize(u8), UnknownFlags(u16), ReservedNonZero { section: &'static str, offset: u64, }, Offset { section: &'static str, offset: u64, }, Truncated { needed: u64, found: u64, }, TrailingBytes { at: u64, }, Count { field: &'static str, value: u64, }, Padding { offset: u64, }, HashMismatch, DialectMismatch(u64), NotCanonical, StringRef(u32), NodeRef(u32), Node { id: u32, reason: &'static str, }, Utf8 { offset: u64, }, UnknownUnit(u32), UnitRef(u32), Type { id: u32, reason: &'static str, }, Edge { from: u32, to: u32, }, Annotation { id: u32, reason: &'static str, }, Provenance(&'static str), Extension { tag: u64, reason: &'static str, }, Blob { id: u32, reason: &'static str, }, SecretEntry(u32), DuplicateField { node: u32, }, DuplicateBinding, Cycle { node: u32, }, Depth { limit: u32, }, Limit { kind: &'static str, limit: u64, }, InvalidArgument(&'static str), Evaluation(&'static str), Encode(&'static str), EncodeDangling(u32), TooLarge, StreamMagic, StreamVersion(u8), StreamFrameLen { declared: u32, available: u64, }, StreamFrameKind(u8), StreamSequence { expected: u64, found: u64, }, StreamState(&'static str), StreamHashMismatch, StreamDelta(&'static str), StreamUnterminated,
}
Expand description

A codec, validation or streaming failure.

Variant documentation states the condition; field names are stable API.

Variants§

§

Magic

Input does not start with the AINF magic.

§

VersionMajor(u16)

Unsupported major format version.

§

VersionMinor(u16)

Unsupported minor format version (readers never guess forward).

§

HeaderTruncated

Header is shorter than the fixed 160-byte prefix.

§

HeaderSize(u8)

Header header_size field is not the supported fixed size.

§

UnknownFlags(u16)

Header flags set bits this reader does not understand.

§

ReservedNonZero

A reserved header or record field was non-zero.

Fields

§section: &'static str
§offset: u64
§

Offset

A section offset or byte range is out of bounds, misaligned, overlapping, or not in canonical ascending order.

Fields

§section: &'static str
§offset: u64
§

Truncated

The buffer is longer or shorter than the sections it declares.

Fields

§needed: u64
§found: u64
§

TrailingBytes

The buffer declares trailing bytes after the final section.

Fields

§at: u64
§

Count

A count field cannot be satisfied by the remaining bytes, or exceeds the configured limits.

Fields

§field: &'static str
§value: u64
§

Padding

Non-zero padding byte (canonical images pad with zero only).

Fields

§offset: u64
§

HashMismatch

Stored content hash does not match the recomputed hash.

§

DialectMismatch(u64)

The declared dialect hash is not the dialect this reader implements.

§

NotCanonical

A buffer self-declares canonical form but re-encoding differs.

§

StringRef(u32)

A string id is out of range.

§

NodeRef(u32)

A node id is out of range.

§

Node

A node record violates the per-kind contract.

Fields

§id: u32
§reason: &'static str
§

Utf8

String heap bytes are not valid UTF-8.

Fields

§offset: u64
§

UnknownUnit(u32)

A unit discriminant is not one this reader implements.

§

UnitRef(u32)

A quantity or type reference is out of range.

§

Type

A type-table entry is malformed.

Fields

§id: u32
§reason: &'static str
§

Edge

An edge endpoint is out of range or an edge is self-referential.

Fields

§from: u32
§to: u32
§

Annotation

An annotation record is malformed.

Fields

§id: u32
§reason: &'static str
§

Provenance(&'static str)

The provenance block is malformed.

§

Extension

An extension block is malformed or overlaps another block.

Fields

§tag: u64
§reason: &'static str
§

Blob

A blob entry is malformed.

Fields

§id: u32
§reason: &'static str
§

SecretEntry(u32)

A secret-table entry is malformed.

§

DuplicateField

A table field name repeats.

Fields

§node: u32
§

DuplicateBinding

A binding name repeats.

§

Cycle

A node participates in a dependency cycle.

Fields

§node: u32
§

Depth

Nesting depth exceeds the configured limit while validating.

Fields

§limit: u32
§

Limit

A configured decode limit was exceeded.

Fields

§kind: &'static str
§limit: u64
§

InvalidArgument(&'static str)

A caller-supplied value is outside its legal range.

§

Evaluation(&'static str)

The Active evaluator rejected the module; the payload is its stable diagnostic class (S001, T001, X00n, …).

§

Encode(&'static str)

A module cannot be encoded (dangling reference, duplicate key, …).

§

EncodeDangling(u32)

A node id referenced during encoding does not exist.

§

TooLarge

The encoded image would exceed u32 offset space.

§

StreamMagic

Stream frame magic AINS missing.

§

StreamVersion(u8)

Unsupported stream frame version.

§

StreamFrameLen

A stream frame length exceeds the limit or the available bytes.

Fields

§declared: u32
§available: u64
§

StreamFrameKind(u8)

A stream frame kind is unknown.

§

StreamSequence

A stream frame is out of sequence or the stream is truncated.

Fields

§expected: u64
§found: u64
§

StreamState(&'static str)

A frame arrived before Begin or after End.

§

StreamHashMismatch

The reassembled module hash does not match the End frame.

§

StreamDelta(&'static str)

A delta operation cannot be applied to the current module state.

§

StreamUnterminated

The stream ended without an End frame.

Implementations§

Source§

impl Error

Source

pub const fn code(&self) -> &'static str

Permanent, machine-readable code. Stable across releases.

Source

pub const fn is_fatal(&self) -> bool

True when the failure means the input is untrusted or corrupt.

All decode-side failures are fatal for the buffer: callers must drop it rather than retrying with a different configuration.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

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 From<Utf8Error> for Error

Source§

fn from(_: Utf8Error) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Self) -> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

Source§

type Output = T

Should always be Self
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.