Struct wasmtime_environ::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 NOEXTERN: RefType = _
pub const NOEXTERN: RefType = _
A non-nullable reference to a noextern object aka (ref noextern)
.
sourcepub const fn indexed_func(nullable: bool, index: u32) -> Option<RefType>
pub const fn indexed_func(nullable: bool, index: u32) -> Option<RefType>
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.
sourcepub const fn indexed_array(nullable: bool, index: u32) -> Option<RefType>
pub const fn indexed_array(nullable: bool, index: u32) -> Option<RefType>
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.
sourcepub const fn indexed_struct(nullable: bool, index: u32) -> Option<RefType>
pub const fn indexed_struct(nullable: bool, index: u32) -> Option<RefType>
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.
sourcepub const fn new(nullable: bool, heap_type: HeapType) -> Option<RefType>
pub const 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 const fn is_typed_func_ref(&self) -> bool
pub const fn is_typed_func_ref(&self) -> bool
Is this a reference to a typed function?
sourcepub const fn is_indexed_type_ref(&self) -> bool
pub const fn is_indexed_type_ref(&self) -> bool
Is this a reference to an indexed type?
sourcepub const fn type_index(&self) -> Option<u32>
pub const 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 an untyped function reference 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 a (ref null extern)
aka externref
?
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<RefType> for RefType
impl PartialEq<RefType> 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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.