Struct RegId

Source
pub struct RegId(/* private fields */);
Expand description

Represents a 6-bit register ID, guaranteed to be masked by construction.

Implementations§

Source§

impl RegId

Source

pub const BAL: Self

Received balance for this context.

Source

pub const CGAS: Self

Remaining gas in the context.

Source

pub const ERR: Self

Error codes for particular operations.

Source

pub const FLAG: Self

Flags register.

Source

pub const FP: Self

Frame pointer. Memory address of beginning of current call frame.

Source

pub const GGAS: Self

Remaining gas globally.

Source

pub const HP: Self

Heap pointer. Memory address below the current bottom of the heap (points to free memory).

Source

pub const IS: Self

Instructions start. Pointer to the start of the currently-executing code.

Source

pub const OF: Self

Contains overflow/underflow of addition, subtraction, and multiplication.

Source

pub const ONE: Self

Contains one (1), for convenience.

Source

pub const PC: Self

The program counter. Memory address of the current instruction.

Source

pub const RET: Self

Return value or pointer.

Source

pub const RETL: Self

Return value length in bytes.

Source

pub const SP: Self

Stack pointer. Memory address on top of current writable stack area (points to free memory).

Source

pub const SSP: Self

Stack start pointer. Memory address of bottom of current writable stack area.

Source

pub const WRITABLE: Self

Smallest writable register.

Source

pub const ZERO: Self

Contains zero (0), for convenience.

Source

pub const fn new(u: u8) -> Self

Construct a register ID from the given value.

The given value will be masked to 6 bits.

Source

pub const fn to_u8(self) -> u8

A const alternative to the Into<u8> implementation.

Source§

impl RegId

Source

pub fn new_checked(u: u8) -> Option<RegId>

Construct a register ID from the given value.

Returns None if the value is outside the 6-bit value range.

Source§

impl RegId

Source

pub fn bal() -> Self

Available on crate feature typescript only.

Received balance for this context.

Source

pub fn cgas() -> Self

Available on crate feature typescript only.

Remaining gas in the context.

Source

pub fn err() -> Self

Available on crate feature typescript only.

Error codes for particular operations.

Source

pub fn flag() -> Self

Available on crate feature typescript only.

Flags register.

Source

pub fn fp() -> Self

Available on crate feature typescript only.

Frame pointer. Memory address of beginning of current call frame.

Source

pub fn ggas() -> Self

Available on crate feature typescript only.

Remaining gas globally.

Source

pub fn hp() -> Self

Available on crate feature typescript only.

Heap pointer. Memory address below the current bottom of the heap (points to free memory).

Source

pub fn is() -> Self

Available on crate feature typescript only.

Instructions start. Pointer to the start of the currently-executing code.

Source

pub fn of() -> Self

Available on crate feature typescript only.

Contains overflow/underflow of addition, subtraction, and multiplication.

Source

pub fn one() -> Self

Available on crate feature typescript only.

Contains one (1), for convenience.

Source

pub fn pc() -> Self

Available on crate feature typescript only.

The program counter. Memory address of the current instruction.

Source

pub fn ret() -> Self

Available on crate feature typescript only.

Return value or pointer.

Source

pub fn retl() -> Self

Available on crate feature typescript only.

Return value length in bytes.

Source

pub fn sp() -> Self

Available on crate feature typescript only.

Stack pointer. Memory address on top of current writable stack area (points to free memory).

Source

pub fn spp() -> Self

Available on crate feature typescript only.

Stack start pointer. Memory address of bottom of current writable stack area.

Source

pub fn writable() -> Self

Available on crate feature typescript only.

Smallest writable register.

Source

pub fn zero() -> Self

Available on crate feature typescript only.

Contains zero (0), for convenience.

Source

pub fn new_typescript(u: u8) -> Self

Available on crate feature typescript only.

Construct a register ID from the given value.

The given value will be masked to 6 bits.

Source

pub fn to_u8_typescript(self) -> u8

Available on crate feature typescript only.

A const alternative to the Into<u8> implementation.

Trait Implementations§

Source§

impl CheckRegId for RegId

Source§

fn check(self) -> RegId

Convert to a RegId, or panic
Source§

impl Clone for RegId

Source§

fn clone(&self) -> RegId

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RegId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<RegId> for JsValue

Source§

fn from(value: RegId) -> Self

Converts to this type from the input type.
Source§

impl From<RegId> for u8

Source§

fn from(RegId: RegId) -> Self

Converts to this type from the input type.
Source§

impl From<RegId> for usize

Source§

fn from(r: RegId) -> usize

Converts to this type from the input type.
Source§

impl From<u8> for RegId

Source§

fn from(u: u8) -> Self

Converts to this type from the input type.
Source§

impl FromWasmAbi for RegId

Source§

type Abi = u32

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: u32) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl Hash for RegId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> Index<RegId> for [T]
where [T]: Index<usize, Output = T>,

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, ix: RegId) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<RegId> for [T]
where [T]: IndexMut<usize, Output = T>,

Source§

fn index_mut(&mut self, ix: RegId) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl IntoWasmAbi for RegId

Source§

type Abi = u32

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> u32

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl LongRefFromWasmAbi for RegId

Source§

type Abi = u32

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRef<RegId>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl OptionFromWasmAbi for RegId

Source§

fn is_none(abi: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl OptionIntoWasmAbi for RegId

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl Ord for RegId

Source§

fn cmp(&self, other: &RegId) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for RegId

Source§

fn eq(&self, other: &RegId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for RegId

Source§

fn partial_cmp(&self, other: &RegId) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl RefFromWasmAbi for RegId

Source§

type Abi = u32

The Wasm ABI type references to Self are recovered from.
Source§

type Anchor = RcRef<RegId>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous.
Source§

unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Source§

impl RefMutFromWasmAbi for RegId

Source§

type Abi = u32

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRefMut<RegId>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl TryFromJsValue for RegId

Source§

type Error = JsValue

The type returned in the event of a conversion error.
Source§

fn try_from_js_value(value: JsValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl VectorFromWasmAbi for RegId

Source§

type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi

Source§

unsafe fn vector_from_abi(js: Self::Abi) -> Box<[RegId]>

Source§

impl VectorIntoJsValue for RegId

Source§

impl VectorIntoWasmAbi for RegId

Source§

type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi

Source§

fn vector_into_abi(vector: Box<[RegId]>) -> Self::Abi

Source§

impl WasmDescribe for RegId

Source§

impl WasmDescribeVector for RegId

Source§

impl Copy for RegId

Source§

impl Eq for RegId

Source§

impl StructuralPartialEq for RegId

Source§

impl SupportsConstructor for RegId

Source§

impl SupportsInstanceProperty for RegId

Source§

impl SupportsStaticProperty for RegId

Auto Trait Implementations§

§

impl Freeze for RegId

§

impl RefUnwindSafe for RegId

§

impl Send for RegId

§

impl Sync for RegId

§

impl Unpin for RegId

§

impl UnwindSafe for RegId

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.