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 fn concrete(nullable: bool, index: u32) -> Option<Self>
pub fn concrete(nullable: bool, index: u32) -> Option<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 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<u32>
pub fn type_index(&self) -> Option<u32>
If this is a reference to a typed function, 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) -> Self
pub const fn as_non_null(&self) -> Self
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<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 PartialEq for RefType
impl PartialEq for RefType
impl Copy for RefType
impl Eq for RefType
impl StructuralEq for RefType
impl StructuralPartialEq for RefType
Auto Trait Implementations§
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.