[−][src]Struct gc_arena::Gc
A garbage collected pointer to a type T. Implements Copy, and is implemented as a plain machine
pointer. You can only allocate Gc
pointers through an Allocator
inside an arena type, and
through "generativity" such Gc
pointers may not escape the arena they were born in or be
stored inside TLS. This, combined with correct Collect
implementations, means that Gc
pointers will never be dangling and are always safe to access.
Methods
impl<'gc, T: 'gc + Collect> Gc<'gc, T>
[src]
pub fn allocate(mc: MutationContext<'gc, '_>, t: T) -> Gc<'gc, T>
[src]
pub fn write_barrier(mc: MutationContext<'gc, '_>, gc: Self)
[src]
When implementing Collect
on types with internal mutability containing Gc
pointers, this
method must be used to ensure safe mutability. Safe to call, but only necessary from unsafe
code.
pub fn ptr_eq(this: Gc<'gc, T>, other: Gc<'gc, T>) -> bool
[src]
pub fn as_ptr(gc: Gc<'gc, T>) -> *const T
[src]
Trait Implementations
impl<'gc, T: 'gc + Collect> Collect for Gc<'gc, T>
[src]
fn trace(&self, cc: CollectionContext)
[src]
fn needs_trace() -> bool where
Self: Sized,
[src]
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. Read more
impl<'gc, T: Collect + 'gc> Copy for Gc<'gc, T>
[src]
impl<'gc, T: Collect + 'gc> Clone for Gc<'gc, T>
[src]
fn clone(&self) -> Gc<'gc, T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'gc, T: Collect + 'gc> Deref for Gc<'gc, T>
[src]
impl<'gc, T: 'gc + Collect> Debug for Gc<'gc, T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,