#[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
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more