Struct wasmparser::PackedIndex
source · 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<Self>
pub fn from_module_index(index: u32) -> Option<Self>
Construct a PackedIndex
from an index into a module’s types space.
sourcepub fn from_rec_group_index(index: u32) -> Option<Self>
pub fn from_rec_group_index(index: u32) -> Option<Self>
Construct a PackedIndex
from an index into the index’s containing
recursion group.
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.
Trait Implementations§
source§impl Clone for PackedIndex
impl Clone for PackedIndex
source§fn clone(&self) -> PackedIndex
fn clone(&self) -> PackedIndex
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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,
Compares and returns the maximum of two values. Read more
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)