wasmtime_environ::wasmparser

Struct RefType

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

A reference type.

The reference types proposal first introduced externref and funcref.

The function references proposal introduced typed function references.

The GC proposal introduces heap types: any, eq, i31, struct, array, nofunc, noextern, none.

Implementations§

Source§

impl RefType

Source

pub const FUNCREF: RefType = _

A nullable untyped function reference aka (ref null func) aka funcref aka anyfunc.

Source

pub const EXTERNREF: RefType = _

A nullable reference to an extern object aka (ref null extern) aka externref.

Source

pub const ANYREF: RefType = _

A nullable reference to any object aka (ref null any) aka anyref.

Source

pub const NULLREF: RefType = _

A nullable reference to no object aka (ref null none) aka nullref.

Source

pub const NULLEXTERNREF: RefType = _

A nullable reference to a noextern object aka (ref null noextern) aka nullexternref.

Source

pub const NULLFUNCREF: RefType = _

A nullable reference to a nofunc object aka (ref null nofunc) aka nullfuncref.

Source

pub const EQREF: RefType = _

A nullable reference to an eq object aka (ref null eq) aka eqref.

Source

pub const STRUCTREF: RefType = _

A nullable reference to a struct aka (ref null struct) aka structref.

Source

pub const ARRAYREF: RefType = _

A nullable reference to an array aka (ref null array) aka arrayref.

Source

pub const I31REF: RefType = _

A nullable reference to an i31 object aka (ref null i31) aka i31ref.

Source

pub const EXNREF: RefType = _

A nullable reference to an exception object aka (ref null exn) aka exnref.

Source

pub const NULLEXNREF: RefType = _

A nullable reference to a noexn object aka (ref null noexn) aka nullexnref.

Source

pub const FUNC: RefType = _

A non-nullable untyped function reference aka (ref func).

Source

pub const EXTERN: RefType = _

A non-nullable reference to an extern object aka (ref extern).

Source

pub const ANY: RefType = _

A non-nullable reference to any object aka (ref any).

Source

pub const NONE: RefType = _

A non-nullable reference to no object aka (ref none).

Source

pub const NOEXTERN: RefType = _

A non-nullable reference to a noextern object aka (ref noextern).

Source

pub const NOFUNC: RefType = _

A non-nullable reference to a nofunc object aka (ref nofunc).

Source

pub const EQ: RefType = _

A non-nullable reference to an eq object aka (ref eq).

Source

pub const STRUCT: RefType = _

A non-nullable reference to a struct aka (ref struct).

Source

pub const ARRAY: RefType = _

A non-nullable reference to an array aka (ref array).

Source

pub const I31: RefType = _

A non-nullable reference to an i31 object aka (ref i31).

Source

pub const EXN: RefType = _

A non-nullable reference to an exn object aka (ref exn).

Source

pub const NOEXN: RefType = _

A non-nullable reference to a noexn object aka (ref noexn).

Source

pub fn concrete(nullable: bool, index: PackedIndex) -> RefType

Create a reference to a concrete Wasm-defined type at the given index.

Returns None when the type index is beyond this crate’s implementation limits and therefore is not representable.

Source

pub fn new(nullable: bool, heap_type: HeapType) -> Option<RefType>

Create a new RefType.

Returns None when the heap type’s type index (if any) is beyond this crate’s implementation limits and therefore is not representable.

Source

pub fn difference(a: RefType, b: RefType) -> RefType

Compute the type difference between the two given ref types.

Source

pub const fn is_concrete_type_ref(&self) -> bool

Is this a reference to an concrete type?

Source

pub fn type_index(&self) -> Option<PackedIndex>

If this is a reference to a concrete Wasm-defined type, get its type index.

Source

pub const fn is_func_ref(&self) -> bool

Is this the abstract untyped function reference type aka (ref null func) aka funcref aka anyfunc?

Source

pub const fn is_extern_ref(&self) -> bool

Is this the abstract external reference type aka (ref null extern) aka externref?

Source

pub const fn is_array_ref(&self) -> bool

Is this the abstract untyped array reference type aka (ref null array) aka arrayref?

Source

pub const fn is_struct_ref(&self) -> bool

Is this the abstract untyped struct reference type aka (ref null struct) aka structref?

Source

pub const fn is_nullable(&self) -> bool

Is this ref type nullable?

Source

pub const fn as_non_null(&self) -> RefType

Get the non-nullable version of this ref type.

Source

pub const fn nullable(&self) -> RefType

Get the nullable version of this ref type.

Source

pub const fn shared(&self) -> Option<RefType>

Get the shared version of this ref type as long as it is abstract.

Source

pub fn heap_type(&self) -> HeapType

Get the heap type that this is a reference to.

Trait Implementations§

Source§

impl Clone for RefType

Source§

fn clone(&self) -> RefType

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 RefType

Source§

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

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

impl Display for RefType

Source§

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

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

impl From<RefType> for ValType

Source§

fn from(ty: RefType) -> ValType

Converts to this type from the input type.
Source§

impl<'a> FromReader<'a> for RefType

Source§

fn from_reader( reader: &mut BinaryReader<'a>, ) -> Result<RefType, BinaryReaderError>

Attempts to read Self from the provided binary reader, returning an error if it is unable to do so.
Source§

impl Hash for RefType

Source§

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

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 Ord for RefType

Source§

fn cmp(&self, other: &RefType) -> 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 RefType

Source§

fn eq(&self, other: &RefType) -> 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 RefType

Source§

fn partial_cmp(&self, other: &RefType) -> 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 Copy for RefType

Source§

impl Eq for RefType

Source§

impl StructuralPartialEq for RefType

Auto Trait Implementations§

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 T)

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

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.