Struct wasmtime_runtime::VMGcHeader
source · pub struct VMGcHeader(/* private fields */);
Expand description
The common header for all objects allocated in a GC heap.
This header is shared across all collectors, although particular collectors may always add their own trailing fields to this header for all of their own GC objects.
This is a bit-packed structure that logically has the following fields:
ⓘ
struct VMGcHeader {
// Highest 2 bits.
kind: VMGcKind,
// 30 bits available for the `GcRuntime` to make use of however it sees fit.
reserved: u30,
// The `VMSharedTypeIndex` for this GC object, if it isn't an
// `externref` (or an `externref` re-wrapped as an `anyref`). `None` is
// represented with `VMSharedTypeIndex::default()`.
ty: Option<VMSharedTypeIndex>,
}
Implementations§
source§impl VMGcHeader
impl VMGcHeader
sourcepub fn reserved_u30(&self) -> u32
pub fn reserved_u30(&self) -> u32
Get the reserved 30 bits in this header.
These are bits are reserved for GcRuntime
implementations to make use
of however they see fit.
sourcepub fn set_reserved_u30(&mut self, value: u32)
pub fn set_reserved_u30(&mut self, value: u32)
sourcepub unsafe fn unchecked_set_reserved_u30(&mut self, value: u32)
pub unsafe fn unchecked_set_reserved_u30(&mut self, value: u32)
Set the 30-bit reserved value.
§Safety
The given value
must only use the lower 30 bits; its upper 2 bits must
be unset.
sourcepub fn ty(&self) -> Option<VMSharedTypeIndex>
pub fn ty(&self) -> Option<VMSharedTypeIndex>
Get this object’s specific concrete type.
Trait Implementations§
source§impl GcHeapObject for VMGcHeader
impl GcHeapObject for VMGcHeader
source§fn is(_: &VMGcHeader) -> bool
fn is(_: &VMGcHeader) -> bool
Check whether the GC object with the given header is an instance of
Self
.Auto Trait Implementations§
impl Freeze for VMGcHeader
impl RefUnwindSafe for VMGcHeader
impl Send for VMGcHeader
impl Sync for VMGcHeader
impl Unpin for VMGcHeader
impl UnwindSafe for VMGcHeader
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