[−][src]Struct scoped_gc::Gc
A smart pointer to a value managed by a garbage-collector
This pointer can be created either by allocating a new garbage-collected value using the
GcScope::alloc
method or by cloning an existing Gc
pointer with Gc::clone
.
This pointer can only be used during the lifetime of the corresponding garbage-collected
scope (represented by the lifetime 'gc
).
By default, a Gc
pointer acts as a root for its value: as long as the Gc
is on the stack
its value is kept alive.
A Gc
is unrooted only when it is moved (transitively) inside another Gc
.
Trait Implementations
impl<'gc, T: Trace> Trace for Gc<'gc, T>
[src]
unsafe fn mark(&self)
[src]
Marks the value in the GcBox
as reachable.
The mark
signal will be propagated further in the object graph unless the box was already
marked (to avoid infinite loops on cycles, or redundant traversals).
unsafe fn root(&self)
[src]
Tags this Gc
pointer as a root for its value.
unsafe fn unroot(&self)
[src]
Untags this Gc
pointer as a root for its value.
impl<'gc, T: Trace + 'gc> Clone for Gc<'gc, T>
[src]
Creates a new Gc
pointer for the same value.
It is recommended to use it as Gc::clone(&gc)
instead of gc.clone()
to avoid confusion
with the clone
method of the inner value.
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: Trace> Drop for Gc<'gc, T>
[src]
impl<'gc, T: Debug + Trace + 'gc> Debug for Gc<'gc, T>
[src]
impl<'gc, T: Trace> Deref for Gc<'gc, T>
[src]
The Deref
implementation allows to use the value's methods directly on the Gc
pointer.
Auto Trait Implementations
impl<'gc, T> !Sync for Gc<'gc, T>
impl<'gc, T> !Send for Gc<'gc, T>
impl<'gc, T> !Unpin for Gc<'gc, T>
impl<'gc, T> !RefUnwindSafe for Gc<'gc, T>
impl<'gc, T> !UnwindSafe for Gc<'gc, T>
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,