Struct TrapCode
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§
§impl TrapCode
impl TrapCode
pub const STACK_OVERFLOW: TrapCode = _
pub const STACK_OVERFLOW: TrapCode = _
The current stack space was exhausted.
pub const INTEGER_OVERFLOW: TrapCode = _
pub const INTEGER_OVERFLOW: TrapCode = _
An integer arithmetic operation caused an overflow.
pub 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.
pub const INTEGER_DIVISION_BY_ZERO: TrapCode = _
pub const INTEGER_DIVISION_BY_ZERO: TrapCode = _
An integer division by zero.
pub const BAD_CONVERSION_TO_INTEGER: TrapCode = _
pub const BAD_CONVERSION_TO_INTEGER: TrapCode = _
Failed float-to-int conversion.
pub 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.
pub const fn unwrap_user(code: u8) -> TrapCode
pub const fn unwrap_user(code: u8) -> TrapCode
Alias for TrapCode::user
with a panic built-in.
pub const fn from_raw(byte: NonZero<u8>) -> TrapCode
pub const fn from_raw(byte: NonZero<u8>) -> TrapCode
Creates a trap code from its raw byte, likely returned by
TrapCode::as_raw
previously.
pub 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§
§impl<'de> Deserialize<'de> for TrapCode
impl<'de> Deserialize<'de> for TrapCode
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TrapCode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TrapCode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Serialize for TrapCode
impl Serialize for TrapCode
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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