pub struct PackedIndex(/* private fields */);
Expand description
A packed representation of a type index.
This type is morally an enum
of either:
-
An index into a Wasm module’s type space.
-
A
CoreTypeId
identifier. -
An index into a recursion group’s elements.
The latter two variants are canonical while the first is not. Reading raw types will produce (1), while working with types after validation will produce (2) and (3).
Implementations§
Source§impl PackedIndex
impl PackedIndex
Sourcepub fn from_module_index(index: u32) -> Option<PackedIndex>
pub fn from_module_index(index: u32) -> Option<PackedIndex>
Construct a PackedIndex
from an index into a module’s types space.
Sourcepub fn from_rec_group_index(index: u32) -> Option<PackedIndex>
pub fn from_rec_group_index(index: u32) -> Option<PackedIndex>
Construct a PackedIndex
from an index into the index’s containing
recursion group.
Sourcepub fn from_id(id: CoreTypeId) -> Option<PackedIndex>
pub fn from_id(id: CoreTypeId) -> Option<PackedIndex>
Construct a PackedIndex
from the given CoreTypeId
.
Sourcepub fn is_canonical(&self) -> bool
pub fn is_canonical(&self) -> bool
Is this index in canonical form?
Sourcepub fn unpack(&self) -> UnpackedIndex
pub fn unpack(&self) -> UnpackedIndex
Uncompress this packed index into an actual enum
that can be matched
on.
Sourcepub fn as_module_index(&self) -> Option<u32>
pub fn as_module_index(&self) -> Option<u32>
Get the underlying index into a module’s types space, if any.
Sourcepub fn as_rec_group_index(&self) -> Option<u32>
pub fn as_rec_group_index(&self) -> Option<u32>
Get the underlying index into the containing recursion group, if any.
Sourcepub fn as_core_type_id(&self) -> Option<CoreTypeId>
pub fn as_core_type_id(&self) -> Option<CoreTypeId>
Get the underlying CoreTypeId
, if any.
Trait Implementations§
Source§impl Clone for PackedIndex
impl Clone for PackedIndex
Source§fn clone(&self) -> PackedIndex
fn clone(&self) -> PackedIndex
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PackedIndex
impl Debug for PackedIndex
Source§impl Display for PackedIndex
impl Display for PackedIndex
Source§impl Hash for PackedIndex
impl Hash for PackedIndex
Source§impl Ord for PackedIndex
impl Ord for PackedIndex
Source§fn cmp(&self, other: &PackedIndex) -> Ordering
fn cmp(&self, other: &PackedIndex) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PackedIndex
impl PartialEq for PackedIndex
Source§impl PartialOrd for PackedIndex
impl PartialOrd for PackedIndex
impl Copy for PackedIndex
impl Eq for PackedIndex
impl StructuralPartialEq for PackedIndex
Auto Trait Implementations§
impl Freeze for PackedIndex
impl RefUnwindSafe for PackedIndex
impl Send for PackedIndex
impl Sync for PackedIndex
impl Unpin for PackedIndex
impl UnwindSafe for PackedIndex
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<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