Struct wasmtime_environ::wasmparser::RefType
source · pub struct RefType(_);
Expand description
A reference type.
The reference types proposal first introduced externref
and funcref
.
The function refererences proposal introduced typed function references.
Implementations§
source§impl RefType
impl RefType
sourcepub const FUNCREF: RefType = RefType::from_u32(Self::ANY_FUNC_DISCRIMINANT | Self::NULLABLE_MASK)
pub const FUNCREF: RefType = RefType::from_u32(Self::ANY_FUNC_DISCRIMINANT | Self::NULLABLE_MASK)
An nullable untyped function reference aka (ref null func)
aka
funcref
aka anyfunc
.
sourcepub const EXTERNREF: RefType = RefType::from_u32(Self::EXTERN_DISCRIMINANT | Self::NULLABLE_MASK)
pub const EXTERNREF: RefType = RefType::from_u32(Self::EXTERN_DISCRIMINANT | Self::NULLABLE_MASK)
A nullable reference to an extern object aka (ref null extern)
aka
externref
.
sourcepub const fn typed_func(nullable: bool, index: u32) -> Option<RefType>
pub const fn typed_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 therfore 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 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 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 fn is_func_ref(&self) -> bool
pub fn is_func_ref(&self) -> bool
Is this an untyped function reference aka (ref null func)
aka funcref
aka anyfunc
?
sourcepub fn is_extern_ref(&self) -> bool
pub 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 fn as_non_null(&self) -> RefType
pub 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.