#[repr(C)]pub struct UntypedGcRef { /* private fields */ }
Expand description
A untyped garbage collected pointer to a value, you can think of it as void*
pointer but managed by GC.
This is the equivalent of a garbage collected smart-pointer.
The smart pointer is simply a guarantee to the garbage collector that this points to a garbage collected object with the correct header, and not some arbitrary bits that you’ve decided to heap allocate.
Implementations§
Source§impl UntypedGcRef
impl UntypedGcRef
Sourcepub fn get(&self) -> *mut u8
pub fn get(&self) -> *mut u8
Returns data part of GC object. That is part of allocation after heap object header.
Sourcepub fn is(&self, index: GCInfoIndex) -> bool
pub fn is(&self, index: GCInfoIndex) -> bool
Returns true if object has the same index
.
Sourcepub fn cast<T>(self) -> Option<GcRef<T>>
pub fn cast<T>(self) -> Option<GcRef<T>>
Returns Some(T) if T::index()
is the same as in this object.
Sourcepub unsafe fn cast_unchecked<T>(self) -> GcRef<T>
pub unsafe fn cast_unchecked<T>(self) -> GcRef<T>
Unchecked cast withouth verifying indexes.
Trait Implementations§
Source§impl Clone for UntypedGcRef
impl Clone for UntypedGcRef
Source§fn clone(&self) -> UntypedGcRef
fn clone(&self) -> UntypedGcRef
Returns a duplicate 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 UntypedGcRef
impl Debug for UntypedGcRef
Source§impl PartialEq for UntypedGcRef
impl PartialEq for UntypedGcRef
Source§impl Pointer for UntypedGcRef
impl Pointer for UntypedGcRef
Source§impl TraceTrait for UntypedGcRef
impl TraceTrait for UntypedGcRef
Source§fn trace(&self, vis: &mut Visitor)
fn trace(&self, vis: &mut Visitor)
Function invoking the tracing for an object of type
T
. Read moreSource§extern "C" fn trace_(vis: *mut Visitor, this: *const u8)
extern "C" fn trace_(vis: *mut Visitor, this: *const u8)
trace_
method is used for C FFI safety.Source§fn get_trace_descriptor(this: *const u8) -> TraceDescriptor
fn get_trace_descriptor(this: *const u8) -> TraceDescriptor
Returns trace descriptor for type that implements this trait. Not recommended to override it.
impl Copy for UntypedGcRef
impl Eq for UntypedGcRef
Auto Trait Implementations§
impl Freeze for UntypedGcRef
impl RefUnwindSafe for UntypedGcRef
impl !Send for UntypedGcRef
impl !Sync for UntypedGcRef
impl Unpin for UntypedGcRef
impl UnwindSafe for UntypedGcRef
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