Struct cranelift_wasm::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
impl RefType
sourcepub const FUNCREF: RefType = _
pub const FUNCREF: RefType = _
A nullable untyped function reference aka (ref null func)
aka
funcref
aka anyfunc
.
sourcepub const EXTERNREF: RefType = _
pub const EXTERNREF: RefType = _
A nullable reference to an extern object aka (ref null extern)
aka
externref
.
sourcepub const ANYREF: RefType = _
pub const ANYREF: RefType = _
A nullable reference to any object aka (ref null any)
aka anyref
.
sourcepub const NULLREF: RefType = _
pub const NULLREF: RefType = _
A nullable reference to no object aka (ref null none)
aka nullref
.
sourcepub const NULLEXTERNREF: RefType = _
pub const NULLEXTERNREF: RefType = _
A nullable reference to a noextern object aka (ref null noextern)
aka
nullexternref
.
sourcepub const NULLFUNCREF: RefType = _
pub const NULLFUNCREF: RefType = _
A nullable reference to a nofunc object aka (ref null nofunc)
aka
nullfuncref
.
sourcepub const STRUCTREF: RefType = _
pub const STRUCTREF: RefType = _
A nullable reference to a struct aka (ref null struct)
aka
structref
.
sourcepub const ARRAYREF: RefType = _
pub const ARRAYREF: RefType = _
A nullable reference to an array aka (ref null array)
aka arrayref
.
sourcepub const I31REF: RefType = _
pub const I31REF: RefType = _
A nullable reference to an i31 object aka (ref null i31)
aka i31ref
.
sourcepub const EXNREF: RefType = _
pub const EXNREF: RefType = _
A nullable reference to an exception object aka (ref null exn)
aka
exnref
.
sourcepub const NOEXTERN: RefType = _
pub const NOEXTERN: RefType = _
A non-nullable reference to a noextern object aka (ref noextern)
.
sourcepub fn concrete(nullable: bool, index: PackedIndex) -> RefType
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.
sourcepub fn new(nullable: bool, heap_type: HeapType) -> Option<RefType>
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 therfore is not
representable.
sourcepub fn difference(a: RefType, b: RefType) -> RefType
pub fn difference(a: RefType, b: RefType) -> RefType
Compute the type difference between the two given ref types.
sourcepub const fn is_concrete_type_ref(&self) -> bool
pub const fn is_concrete_type_ref(&self) -> bool
Is this a reference to an concrete type?
sourcepub fn type_index(&self) -> Option<PackedIndex>
pub fn type_index(&self) -> Option<PackedIndex>
If this is a reference to a concrete Wasm-defined type, get its type index.
sourcepub const fn is_func_ref(&self) -> bool
pub const fn is_func_ref(&self) -> bool
Is this the abstract untyped function reference type aka (ref null func)
aka funcref
aka anyfunc
?
sourcepub const fn is_extern_ref(&self) -> bool
pub const fn is_extern_ref(&self) -> bool
Is this the abstract external reference type aka (ref null extern)
aka externref
?
sourcepub const fn is_array_ref(&self) -> bool
pub const fn is_array_ref(&self) -> bool
Is this the abstract untyped array refrence type aka (ref null array)
aka arrayref
?
sourcepub const fn is_struct_ref(&self) -> bool
pub const fn is_struct_ref(&self) -> bool
Is this the abstract untyped struct reference type aka (ref null struct)
aka structref
?
sourcepub const fn is_nullable(&self) -> bool
pub const fn is_nullable(&self) -> bool
Is this ref type nullable?
sourcepub const fn as_non_null(&self) -> RefType
pub const fn as_non_null(&self) -> RefType
Get the non-nullable version of this ref type.
Trait Implementations§
source§impl<'a> FromReader<'a> for RefType
impl<'a> FromReader<'a> for RefType
source§fn from_reader(
reader: &mut BinaryReader<'a>
) -> Result<RefType, BinaryReaderError>
fn from_reader( reader: &mut BinaryReader<'a> ) -> Result<RefType, BinaryReaderError>
Self
from the provided binary reader, returning an
error if it is unable to do so.source§impl PartialEq for RefType
impl PartialEq for RefType
impl Copy for RefType
impl Eq for RefType
impl StructuralPartialEq for RefType
Auto Trait Implementations§
impl Freeze for RefType
impl RefUnwindSafe for RefType
impl Send for RefType
impl Sync for RefType
impl Unpin for RefType
impl UnwindSafe for RefType
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.