pub struct TrapCode(/* private fields */);
Expand description
A trap code describing the reason for a trap.
All trap instructions have an explicit trap code.
Implementations§
Source§impl TrapCode
impl TrapCode
Sourcepub const STACK_OVERFLOW: TrapCode = _
pub const STACK_OVERFLOW: TrapCode = _
The current stack space was exhausted.
Sourcepub const INTEGER_OVERFLOW: TrapCode = _
pub const INTEGER_OVERFLOW: TrapCode = _
An integer arithmetic operation caused an overflow.
Sourcepub const HEAP_OUT_OF_BOUNDS: TrapCode = _
pub const HEAP_OUT_OF_BOUNDS: TrapCode = _
A heap_addr
instruction detected an out-of-bounds error.
Note that not all out-of-bounds heap accesses are reported this way; some are detected by a segmentation fault on the heap unmapped or offset-guard pages.
Sourcepub const INTEGER_DIVISION_BY_ZERO: TrapCode = _
pub const INTEGER_DIVISION_BY_ZERO: TrapCode = _
An integer division by zero.
Sourcepub const BAD_CONVERSION_TO_INTEGER: TrapCode = _
pub const BAD_CONVERSION_TO_INTEGER: TrapCode = _
Failed float-to-int conversion.
Sourcepub const fn user(code: u8) -> Option<TrapCode>
pub const fn user(code: u8) -> Option<TrapCode>
Create a user-defined trap code.
Returns None
if code
is zero or too large and is reserved by
Cranelift.
Sourcepub const fn unwrap_user(code: u8) -> TrapCode
pub const fn unwrap_user(code: u8) -> TrapCode
Alias for TrapCode::user
with a panic built-in.
Sourcepub const fn from_raw(byte: NonZeroU8) -> TrapCode
pub const fn from_raw(byte: NonZeroU8) -> TrapCode
Creates a trap code from its raw byte, likely returned by
TrapCode::as_raw
previously.
Sourcepub const fn non_user_traps() -> &'static [TrapCode]
pub const fn non_user_traps() -> &'static [TrapCode]
Returns a slice of all traps except TrapCode::User
traps
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TrapCode
impl<'de> Deserialize<'de> for TrapCode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for TrapCode
impl Eq for TrapCode
impl StructuralPartialEq for TrapCode
Auto Trait Implementations§
impl Freeze for TrapCode
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more