#[non_exhaustive]pub enum TrapCode {
StackOverflow,
MemoryOutOfBounds,
HeapMisaligned,
TableOutOfBounds,
IndirectCallToNull,
BadSignature,
IntegerOverflow,
IntegerDivisionByZero,
BadConversionToInteger,
UnreachableCodeReached,
Interrupt,
AlwaysTrapAdapter,
}
Expand description
A trap code describing the reason for a trap.
All trap instructions have an explicit trap code.
The code can be accessed from the c-api, where the possible values are translated into enum values defined there:
wasm_trap_code
in c-api/src/trap.rs, andwasmtime_trap_code_enum
in c-api/include/wasmtime/trap.h.
These need to be kept in sync.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
StackOverflow
The current stack space was exhausted.
MemoryOutOfBounds
An out-of-bounds memory access.
HeapMisaligned
A wasm atomic operation was presented with a not-naturally-aligned linear-memory address.
TableOutOfBounds
An out-of-bounds access to a table.
IndirectCallToNull
Indirect call to a null table entry.
BadSignature
Signature mismatch on indirect call.
IntegerOverflow
An integer arithmetic operation caused an overflow.
IntegerDivisionByZero
An integer division by zero.
BadConversionToInteger
Failed float-to-int conversion.
UnreachableCodeReached
Code that was supposed to have been unreachable was reached.
Interrupt
Execution has potentially run too long and may be interrupted.
AlwaysTrapAdapter
When the component-model
feature is enabled this trap represents a
function that was canon lift
’d, then canon lower
’d, then called.
This combination of creation of a function in the component model
generates a function that always traps and, when called, produces this
flavor of trap.
Trait Implementations§
source§impl PartialEq<TrapCode> for TrapCode
impl PartialEq<TrapCode> for TrapCode
impl Copy for TrapCode
impl Eq for TrapCode
impl StructuralEq for TrapCode
impl StructuralPartialEq for TrapCode
Auto Trait Implementations§
impl RefUnwindSafe for TrapCode
impl Send for TrapCode
impl Sync for TrapCode
impl Unpin for TrapCode
impl UnwindSafe for TrapCode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CallHasher for Twhere
T: Hash + ?Sized,
impl<T> CallHasher for Twhere T: Hash + ?Sized,
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.