Skip to main content

DecodeErrorCode

Enum DecodeErrorCode 

Source
#[repr(u32)]
pub enum DecodeErrorCode {
Show 36 variants BufferTooShort = 1_000, InvalidMagic = 1_001, UnsupportedMajorVersion = 1_002, UnsupportedMinorVersion = 1_003, InvalidHeaderLength = 1_004, InvalidFeatureFlags = 1_005, InvalidReservedField = 1_006, SectionTableOutOfBounds = 1_007, DuplicateSection = 1_008, MissingRequiredSection = 1_009, UnknownSection = 1_010, UnknownRequiredSection = 1_011, InvalidSectionFlags = 1_012, InvalidSectionAlignment = 1_013, InvalidSectionBounds = 1_014, InvalidRecordSize = 1_015, InvalidSectionCount = 1_016, OverlappingSection = 1_017, InvalidPadding = 1_018, TrailingPadding = 1_019, InvalidStringOffset = 1_020, InvalidUtf8 = 1_021, InvalidStringRef = 1_022, InvalidSourceRef = 1_023, InvalidRootRef = 1_024, InvalidNodeRef = 1_025, InvalidTokenRef = 1_026, InvalidTriviaRef = 1_027, UnknownSyntaxKind = 1_028, InvalidDiagnosticSeverity = 1_029, UnknownDiagnosticCode = 1_030, InvalidDiagnosticRange = 1_031, InvalidSourceTextRange = 1_032, InvalidExtendedData = 1_033, InvalidEdgeKind = 1_034, InvalidSpan = 1_035,
}
Expand description

Programmatic decode failure code (1000..1999).

Code values are stable across the v0.1 surface so tests, fixture validators, and language bindings can match on them without parsing human-readable messages. The #[repr(u32)] with explicit discriminants is the enforcement mechanism: reordering or inserting a variant in the wrong place would change a stable numeric value, and the snapshot_compat.rs guard test catches it. When adding a new variant, append it at the end with the next unused number and update the guard test in the same commit.

Variants§

§

BufferTooShort = 1_000

§

InvalidMagic = 1_001

§

UnsupportedMajorVersion = 1_002

§

UnsupportedMinorVersion = 1_003

§

InvalidHeaderLength = 1_004

§

InvalidFeatureFlags = 1_005

§

InvalidReservedField = 1_006

§

SectionTableOutOfBounds = 1_007

§

DuplicateSection = 1_008

§

MissingRequiredSection = 1_009

§

UnknownSection = 1_010

§

UnknownRequiredSection = 1_011

§

InvalidSectionFlags = 1_012

§

InvalidSectionAlignment = 1_013

§

InvalidSectionBounds = 1_014

§

InvalidRecordSize = 1_015

§

InvalidSectionCount = 1_016

§

OverlappingSection = 1_017

§

InvalidPadding = 1_018

§

TrailingPadding = 1_019

§

InvalidStringOffset = 1_020

§

InvalidUtf8 = 1_021

§

InvalidStringRef = 1_022

§

InvalidSourceRef = 1_023

§

InvalidRootRef = 1_024

§

InvalidNodeRef = 1_025

§

InvalidTokenRef = 1_026

§

InvalidTriviaRef = 1_027

§

UnknownSyntaxKind = 1_028

§

InvalidDiagnosticSeverity = 1_029

§

UnknownDiagnosticCode = 1_030

§

InvalidDiagnosticRange = 1_031

§

InvalidSourceTextRange = 1_032

§

InvalidExtendedData = 1_033

§

InvalidEdgeKind = 1_034

§

InvalidSpan = 1_035

Implementations§

Source§

impl DecodeErrorCode

Source

pub const fn as_u32(self) -> u32

Stable numeric value used by tests, fixture validators, and language bindings. The mapping is locked by the compatibility guard in tests/snapshot_compat.rs.

Source

pub const fn as_ox_mf2_error_code(self) -> OxMf2ErrorCode

Binding-oriented alias for Self::as_u32.

Source

pub const fn as_u16(self) -> u16

Legacy helper retained for callers that still use u16 widths. Values fit in u16 for the v0.1 decode domain.

Source

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

Trait Implementations§

Source§

impl Clone for DecodeErrorCode

Source§

fn clone(&self) -> DecodeErrorCode

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 Copy for DecodeErrorCode

Source§

impl Debug for DecodeErrorCode

Source§

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

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

impl Display for DecodeErrorCode

Source§

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

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

impl Eq for DecodeErrorCode

Source§

impl Hash for DecodeErrorCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for DecodeErrorCode

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for DecodeErrorCode

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, 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.