Struct wasmparser::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: Self = _

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

source

pub const EXTERNREF: Self = _

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

source

pub const ANYREF: Self = _

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

source

pub const NULLREF: Self = _

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

source

pub const NULLEXTERNREF: Self = _

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

source

pub const NULLFUNCREF: Self = _

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

source

pub const EQREF: Self = _

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

source

pub const STRUCTREF: Self = _

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

source

pub const ARRAYREF: Self = _

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

source

pub const I31REF: Self = _

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

source

pub const EXNREF: Self = _

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

source

pub const NULLEXNREF: Self = _

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

source

pub const FUNC: Self = _

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

source

pub const EXTERN: Self = _

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

source

pub const ANY: Self = _

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

source

pub const NONE: Self = _

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

source

pub const NOEXTERN: Self = _

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

source

pub const NOFUNC: Self = _

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

source

pub const EQ: Self = _

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

source

pub const STRUCT: Self = _

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

source

pub const ARRAY: Self = _

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

source

pub const I31: Self = _

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

source

pub const EXN: Self = _

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

source

pub const NOEXN: Self = _

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

source

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

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<Self>

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

Get the non-nullable version of this ref type.

source

pub const fn nullable(&self) -> Self

Get the nullable version of this ref type.

source

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

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

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

impl Display for RefType

source§

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

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<Self>

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: 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 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 + PartialOrd,

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

impl PartialEq for RefType

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method 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

This method 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

This method 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

This method 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<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,

§

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>,

§

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>,

§

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.