Trait wasmtime_runtime::GcHeapObject
source · pub unsafe trait GcHeapObject: Send + Sync {
// Required method
fn is(header: &VMGcHeader) -> bool;
}
Expand description
A trait implemented by all objects allocated inside a GC heap.
§Safety
All implementations must:
-
Be
repr(C)
orrepr(transparent)
-
Begin with a
VMGcHeader
as their first field -
Not have
Drop
implementations (aka,std::mem::needs_drop::<Self>()
should returnfalse
). -
Be memory safe to transmute to from an arbitrary byte sequence (that is, it is okay if some bit patterns are invalid with regards to correctness, so long as these invalid bit patterns cannot lead to memory unsafety).
Required Methods§
sourcefn is(header: &VMGcHeader) -> bool
fn is(header: &VMGcHeader) -> bool
Check whether the GC object with the given header is an instance of
Self
.
Object Safety§
This trait is not object safe.