Struct netsblox_vm::gc::GcWeak
source · pub struct GcWeak<'gc, T>where
T: 'gc + ?Sized,{ /* private fields */ }Implementations§
source§impl<'gc, T> GcWeak<'gc, T>where
T: 'gc + ?Sized,
impl<'gc, T> GcWeak<'gc, T>where
T: 'gc + ?Sized,
pub fn upgrade(self, mc: &Mutation<'gc>) -> Option<Gc<'gc, T>>
sourcepub fn is_dropped(self) -> bool
pub fn is_dropped(self) -> bool
Returns whether the value referenced by this GcWeak has been dropped.
Note that calling upgrade may still fail even when this method returns false.
pub fn ptr_eq(this: GcWeak<'gc, T>, other: GcWeak<'gc, T>) -> bool
pub fn as_ptr(self) -> *const T
source§impl<'gc, T> GcWeak<'gc, T>where
T: 'gc,
impl<'gc, T> GcWeak<'gc, T>where
T: 'gc,
sourcepub unsafe fn cast<U>(this: GcWeak<'gc, T>) -> GcWeak<'gc, U>where
U: 'gc,
pub unsafe fn cast<U>(this: GcWeak<'gc, T>) -> GcWeak<'gc, U>where
U: 'gc,
Cast the internal pointer to a different type.
SAFETY:
It must be valid to dereference a *mut U that has come from casting a *mut T.
sourcepub unsafe fn from_ptr(ptr: *const T) -> GcWeak<'gc, T>
pub unsafe fn from_ptr(ptr: *const T) -> GcWeak<'gc, T>
Retrieve a GcWeak from a raw pointer obtained from GcWeak::as_ptr
SAFETY:
The provided pointer must have been obtained from GcWeak::as_ptr or Gc::as_ptr, and
the pointer must not have been fully collected yet (it may be a dropped but live weak
pointer).
Trait Implementations§
source§impl<'gc, T> Collect for GcWeak<'gc, T>where
T: 'gc + ?Sized,
impl<'gc, T> Collect for GcWeak<'gc, T>where
T: 'gc + ?Sized,
source§fn trace(&self, cc: &Collection)
fn trace(&self, cc: &Collection)
Must call
Collect::trace on all held Gc pointers. If this type holds inner types that
implement Collect, a valid implementation would simply call Collect::trace on all the
held values to ensure this.source§fn needs_trace() -> boolwhere
Self: Sized,
fn needs_trace() -> boolwhere
Self: Sized,
As an optimization, if this type can never hold a
Gc pointer and trace is unnecessary
to call, you may implement this method and return false. The default implementation returns
true, signaling that Collect::trace must be called.impl<'gc, T> Copy for GcWeak<'gc, T>where
T: 'gc + ?Sized,
Auto Trait Implementations§
impl<'gc, T> !RefUnwindSafe for GcWeak<'gc, T>
impl<'gc, T> !Send for GcWeak<'gc, T>
impl<'gc, T> !Sync for GcWeak<'gc, T>
impl<'gc, T: ?Sized> Unpin for GcWeak<'gc, T>
impl<'gc, T> !UnwindSafe for GcWeak<'gc, T>
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