Skip to main content

IrError

Enum IrError 

Source
#[non_exhaustive]
pub enum IrError {
Show 43 variants BufferTooShort { expected: usize, actual: usize, }, BadSignature([u8; 8]), LegacyModule { version: u16, }, UnsupportedWriter { writer: [u16; 3], reader: [u16; 3], }, LengthMismatch { declared: usize, actual: usize, }, ChecksumMismatch { expected: u32, computed: u32, }, ReservedBits { field: &'static str, }, DuplicateSection(u16), SectionsDoNotTile, MissingSection(u16), UnknownRequiredSection { id: u16, writer: [u16; 3], }, LimitExceeded(Box<LimitViolation>), TrailingBytes { section: u16, }, InvalidSchema(&'static str), InvalidKeyPath(&'static str), InvalidSourcePosition(&'static str), InvalidDefault(u16), SectionOutOfBounds { section: usize, offset: u32, size: u32, file_len: usize, }, InvalidOpcode(u8), InvalidSlotType(u8), InvalidIslandTrigger(u8), InvalidSlotSource(u8), StringIndexOutOfBounds { index: u32, len: usize, }, InvalidUtf8(String), ListDepthExceeded { max: u8, }, IslandNotFound(u16), JsonParseError(String), InvalidSection, RecursionLimitExceeded, OutputLimitExceeded { limit: usize, }, InvalidIslandState(Box<IslandStateViolation>), IslandStateLimitExceeded { limit: usize, }, InvalidListKey(Box<ListKeyViolation>), ListBudgetExceeded { max: usize, }, InvalidName(String), DuplicateSlotId(u16), DuplicateIslandId(u16), IslandOffsetMismatch { island_id: u16, byte_offset: u32, }, UnknownSlotId(u16), MalformedControlFlow { pos: usize, }, UnknownIslandId(u16), NestedIslandRoot { outer: u16, inner: u16, }, Panicked { message: String, },
}
Expand description

Parser errors and their authoritative code() method. Errors that can occur when parsing FMIR binary data.

Marked #[non_exhaustive]: new failure modes are added as the parser is hardened, and downstream crates must not break when that happens. Match with a _ => arm (or just use Display).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

BufferTooShort

Input buffer is too short to contain the expected structure.

Fields

§expected: usize

Bytes the structure needed.

§actual: usize

Bytes actually available.

§

BadSignature([u8; 8])

Signature is not the FMIR v3 signature.

§

LegacyModule

A legacy FMIR header needs a rebuild.

Fields

§version: u16

Legacy header version.

§

UnsupportedWriter

Writer base version differs from the reader’s Cargo version.

Fields

§writer: [u16; 3]

Writer major/minor/patch.

§reader: [u16; 3]

Reader major/minor/patch.

§

LengthMismatch

Declared body length differs from the actual file.

Fields

§declared: usize

Declared body bytes.

§actual: usize

Actual body bytes.

§

ChecksumMismatch

CRC-32 does not match the file excluding its CRC field.

Fields

§expected: u32

Stored checksum.

§computed: u32

Computed checksum.

§

ReservedBits

Reserved bits must be zero.

Fields

§field: &'static str

Field that carried the bits.

§

DuplicateSection(u16)

Section ids must be strictly ascending and unique.

§

SectionsDoNotTile

Section offsets must cover exactly the data after the table.

§

MissingSection(u16)

A required section was absent.

§

UnknownRequiredSection

An unknown section was marked required.

Fields

§id: u16

Section identifier.

§writer: [u16; 3]

Writer base version.

§

LimitExceeded(Box<LimitViolation>)

An input-controlled size or count exceeds its ceiling.

§

TrailingBytes

Known sections must consume their complete payload.

Fields

§section: u16

Section identifier.

§

InvalidSchema(&'static str)

Invalid props schema type or reference.

§

InvalidKeyPath(&'static str)

Invalid key-path entry.

§

InvalidSourcePosition(&'static str)

Invalid source-position entry.

§

InvalidDefault(u16)

A slot default does not parse for its declared type.

§

SectionOutOfBounds

A section extends beyond the file boundary.

Fields

§section: usize

Index of the offending section in the section table.

§offset: u32

The section’s declared byte offset.

§size: u32

The section’s declared byte length.

§file_len: usize

Length of the file the offsets were read from.

§

InvalidOpcode(u8)

An opcode byte does not map to a known opcode.

§

InvalidSlotType(u8)

A slot-type byte does not map to a known slot type.

§

InvalidIslandTrigger(u8)

An island-trigger byte does not map to a known trigger.

§

InvalidSlotSource(u8)

A slot-source byte does not map to a known source.

§

StringIndexOutOfBounds

A string index is out of bounds.

Fields

§index: u32

The index that was asked for.

§len: usize

Number of entries the string table actually holds.

§

InvalidUtf8(String)

A byte sequence is not valid UTF-8.

§

ListDepthExceeded

Nested LIST depth exceeded the maximum allowed.

Fields

§max: u8

The nesting limit that was exceeded.

§

IslandNotFound(u16)

An island with the given id was not found in the island table.

§

JsonParseError(String)

Failed to parse JSON input.

§

InvalidSection

A section descriptor has invalid values (e.g. integer overflow).

Also returned for opcode-stream offsets that overflow or point outside the region they were read from (branch/body lengths in SHOW_IF, SWITCH, LIST and TRY_START/FALLBACK).

§

RecursionLimitExceeded

Recursive opcode nesting (SHOW_IF, LIST, SWITCH, etc.) exceeded the maximum allowed depth.

§

OutputLimitExceeded

The rendered HTML exceeded the walker’s configured output budget.

Fields

§limit: usize

The byte budget that was exceeded.

§

InvalidIslandState(Box<IslandStateViolation>)

An executed island’s declared request state cannot be projected.

§

IslandStateLimitExceeded

The complete escaped state envelope exceeds its fixed byte ceiling.

Fields

§limit: usize

Maximum complete envelope bytes.

§

InvalidListKey(Box<ListKeyViolation>)

RENDER-503: a keyed list row has no usable identity, repeats another row’s key, or did not render one root element to carry it (FORMA-181). No partial page is returned.

§

ListBudgetExceeded

Total LIST item iterations exceeded the walker’s per-render budget. Distinct from IrError::ListDepthExceeded, which bounds nesting.

Fields

§max: usize

The total-iteration budget that was exceeded.

§

InvalidName(String)

A tag or attribute name from the string table is not a legal HTML name.

§

DuplicateSlotId(u16)

The slot table declares the same slot_id more than once.

§

DuplicateIslandId(u16)

The island table declares the same island id more than once.

§

IslandOffsetMismatch

An island’s byte_offset does not point at an ISLAND_START opcode carrying that island’s own id.

Fields

§island_id: u16

The island whose table entry is wrong.

§byte_offset: u32

The byte offset that entry declared.

§

UnknownSlotId(u16)

A slot id referenced by an island entry or an opcode is not declared in the slot table.

§

MalformedControlFlow

The opcode stream’s control-flow regions do not tile exactly: a branch/body length does not line up with the opcodes it contains.

Fields

§pos: usize

Byte offset in the opcode stream where the mismatch was detected.

§

UnknownIslandId(u16)

An ISLAND_START opcode names an island id the island table does not declare. Such an island emits its <!--f:iN--> markers but no data-forma-* attributes, so the client can never hydrate it.

§

NestedIslandRoot

Two ISLAND_START opcodes are pending on the same element: the outer island’s body opens no tag of its own before the inner island starts, so only one of them can carry the data-forma-island attribute set and the other would silently never hydrate.

Fields

§outer: u16

The island still waiting for a root element.

§inner: u16

The island that started before it got one.

§

Panicked

The walk panicked, and crate::walker::walk_to_html_counted caught the unwind. This reports a defect in the walker, not in the module or the data. Under panic = "abort" there is nothing to catch and the process ends instead.

Fields

§message: String

The panic’s message, when it carried one.

Implementations§

Source§

impl IrError

Source

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

Stable loader diagnostic code, shared with forma-server.

Trait Implementations§

Source§

impl Clone for IrError

Source§

fn clone(&self) -> IrError

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 IrError

Source§

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

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

impl Display for IrError

Source§

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

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

impl Eq for IrError

Source§

impl Error for IrError

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 IrError

Source§

fn eq(&self, other: &IrError) -> 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 IrError

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> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

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

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

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

impl<T> WithSubscriber for T

Source§

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

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

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