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
impl RefType
sourcepub const FUNCREF: Self = _
pub const FUNCREF: Self = _
A nullable untyped function reference aka (ref null func)
aka
funcref
aka anyfunc
.
sourcepub const EXTERNREF: Self = _
pub const EXTERNREF: Self = _
A nullable reference to an extern object aka (ref null extern)
aka
externref
.
sourcepub const NULLEXTERNREF: Self = _
pub const NULLEXTERNREF: Self = _
A nullable reference to a noextern object aka (ref null noextern)
aka
nullexternref
.
sourcepub const NULLFUNCREF: Self = _
pub const NULLFUNCREF: Self = _
A nullable reference to a nofunc object aka (ref null nofunc)
aka
nullfuncref
.
sourcepub const STRUCTREF: Self = _
pub const STRUCTREF: Self = _
A nullable reference to a struct aka (ref null struct)
aka
structref
.
sourcepub const ARRAYREF: Self = _
pub const ARRAYREF: Self = _
A nullable reference to an array aka (ref null array)
aka arrayref
.
sourcepub const I31REF: Self = _
pub const I31REF: Self = _
A nullable reference to an i31 object aka (ref null i31)
aka i31ref
.
sourcepub const EXNREF: Self = _
pub const EXNREF: Self = _
A nullable reference to an exception object aka (ref null exn)
aka
exnref
.
sourcepub const NULLEXNREF: Self = _
pub const NULLEXNREF: Self = _
A nullable reference to a noexn object aka (ref null noexn)
aka
nullexnref
.
sourcepub const CONTREF: Self = _
pub const CONTREF: Self = _
A nullable reference to a cont object aka (ref null cont)
aka
contref
.
sourcepub const NULLCONTREF: Self = _
pub const NULLCONTREF: Self = _
A nullable reference to a nocont object aka (ref null nocont)
aka
nullcontref
.
sourcepub fn concrete(nullable: bool, index: PackedIndex) -> Self
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.
sourcepub fn new(nullable: bool, heap_type: HeapType) -> Option<Self>
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.
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 reference 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_cont_ref(&self) -> bool
pub const fn is_cont_ref(&self) -> bool
Is this the abstract untyped cont reference type aka (ref null cont)
aka contref
?
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) -> Self
pub const fn as_non_null(&self) -> Self
Get the non-nullable version of this ref type.
Get the shared version of this ref type as long as it is abstract.
Trait Implementations§
source§impl<'a> FromReader<'a> for RefType
impl<'a> FromReader<'a> for RefType
source§fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self>
fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self>
Self
from the provided binary reader, returning an
error if it is unable to do so.source§impl Ord for RefType
impl Ord for RefType
source§impl PartialOrd for RefType
impl PartialOrd 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)