#[non_exhaustive]pub enum IrError {
Show 28 variants
BufferTooShort {
expected: usize,
actual: usize,
},
BadMagic([u8; 4]),
UnsupportedVersion(u16),
SectionOutOfBounds {
section: usize,
offset: u32,
size: u32,
file_len: usize,
},
InvalidOpcode(u8),
InvalidSlotType(u8),
InvalidIslandTrigger(u8),
InvalidPropsMode(u8),
InvalidSlotSource(u8),
StringIndexOutOfBounds {
index: u32,
len: usize,
},
InvalidUtf8(String),
ListDepthExceeded {
max: u8,
},
IslandNotFound(u16),
JsonParseError(String),
InvalidSection,
RecursionLimitExceeded,
OutputLimitExceeded {
limit: usize,
},
ListBudgetExceeded {
max: usize,
},
UnsupportedFlags(u16),
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
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
BufferTooShort
Input buffer is too short to contain the expected structure.
BadMagic([u8; 4])
Magic bytes do not match “FMIR”.
UnsupportedVersion(u16)
IR version is not supported.
SectionOutOfBounds
A section extends beyond the file boundary.
Fields
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.
InvalidPropsMode(u8)
A props-mode byte does not map to a known mode.
InvalidSlotSource(u8)
A slot-source byte does not map to a known source.
StringIndexOutOfBounds
A string index is out of bounds.
Fields
InvalidUtf8(String)
A byte sequence is not valid UTF-8.
ListDepthExceeded
Nested LIST depth exceeded the maximum allowed.
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.
ListBudgetExceeded
Total LIST item iterations exceeded the walker’s per-render budget.
Distinct from IrError::ListDepthExceeded, which bounds nesting.
UnsupportedFlags(u16)
The header’s reserved flags field carried an unknown non-zero bit.
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
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.
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
Panicked
The walk panicked, and crate::walker::walk_to_html_counted caught
the unwind. No input is known to cause one (the parser and walker are
fuzzed), so 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.
Trait Implementations§
impl Eq for IrError
Source§impl Error for IrError
impl Error for IrError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()