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 NULLEXNREF: RefType = _
pub const NULLEXNREF: RefType = _
A nullable reference to a noexn object aka (ref null noexn)
aka
nullexnref
.
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 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_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.
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<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 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
)Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.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§impl<T> IntoAnyhow for T
impl<T> IntoAnyhow for T
Source§fn into_anyhow(self) -> Error
fn into_anyhow(self) -> Error
self
into an anyhow::Error
.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more