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 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 fn indexed_func(nullable: bool, index: u32) -> Option<Self>

Create a reference to a typed function with the 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 const fn indexed_array(nullable: bool, index: u32) -> Option<Self>

Create a reference to an array with the 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 const fn indexed_struct(nullable: bool, index: u32) -> Option<Self>

Create a reference to a struct with the 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 const 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 therfore is not representable.

source

pub const fn is_typed_func_ref(&self) -> bool

Is this a reference to a typed function?

source

pub const fn is_indexed_type_ref(&self) -> bool

Is this a reference to an indexed type?

source

pub const fn type_index(&self) -> Option<u32>

If this is a reference to a typed function, get its type index.

source

pub const fn is_func_ref(&self) -> bool

Is this an untyped function reference aka (ref null func) aka funcref aka anyfunc?

source

pub const fn is_extern_ref(&self) -> bool

Is this a (ref null extern) aka externref?

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 non-nullable version of this ref type.

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

source§

impl Eq for RefType

source§

impl StructuralEq for RefType

source§

impl StructuralPartialEq for RefType

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

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

§

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

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

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

§

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 Twhere 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 Twhere 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 Twhere 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 Twhere 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 Twhere 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.