Struct zerogc::cell::GcCell[][src]

#[repr(transparent)]
pub struct GcCell<T: Trace + Copy>(_);

A Cell pointing to a garbage collected object.

This only supports mutating NullTrace types, becuase garbage collected pointers need write barriers.

Implementations

impl<T: Trace + Copy> GcCell<T>[src]

pub fn new(value: T) -> Self[src]

Create a new cell

pub fn get_mut(&mut self) -> &mut T

Notable traits for &'_ mut R

impl<'_, R> Read for &'_ mut R where
    R: Read + ?Sized
impl<'_, W> Write for &'_ mut W where
    W: Write + ?Sized
impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;
[src]

Get a mutable reference to this cell’s value

This is safe because the &mut self guarentes exclusive access to the cell.

pub fn as_ptr(&self) -> *mut T[src]

Get a pointer to this cell’s conent

pub fn get(&self) -> T[src]

Get the current value of this cell

impl<T: NullTrace + Copy> GcCell<T>[src]

pub fn set(&self, value: T)[src]

Change the interior of this type to the specified type

The type must be NullTrace because garbage collected types need write barriers.

Trait Implementations

impl<T: Clone + Trace + Copy> Clone for GcCell<T>[src]

impl<T: Debug + Trace + Copy> Debug for GcCell<T>[src]

impl<T: Default + Trace + Copy> Default for GcCell<T>[src]

impl<'gc, OwningRef, Value> GcDirectBarrier<'gc, OwningRef> for GcCell<Value> where
    Value: GcDirectBarrier<'gc, OwningRef> + Copy
[src]

impl<'min, T, Id> GcErase<'min, Id> for GcCell<T> where
    T: Trace + Copy + GcErase<'min, Id>,
    Id: CollectorId,
    T::Erased: Copy + Trace
[src]

type Erased = GcCell<T::Erased>

This type with all garbage collected lifetimes changed to 'static (or erased) Read more

impl<'new_gc, T, Id> GcRebrand<'new_gc, Id> for GcCell<T> where
    T: Trace + Copy + GcRebrand<'new_gc, Id>,
    Id: CollectorId,
    T::Branded: Copy + Trace
[src]

type Branded = GcCell<T::Branded>

This type with all garbage collected lifetimes changed to 'new_gc Read more

impl<T: GcSafe + Copy> GcSafe for GcCell<T>[src]

const NEEDS_DROP: bool[src]

Since T is Copy, we shouldn’t need to be dropped

impl<T: GcSafe + Copy + NullTrace> NullTrace for GcCell<T>[src]

impl<T: Trace + Copy> Trace for GcCell<T>[src]

GcCell can only support mutating types that are NullTrace, because garbage collected types need write barriers.

However, this is already enforced by the bounds of GcCell::set, so we don’t need to verify here. In other words is possible to safely trace a GcCell with a garbage collected type, as long as it is never mutated.

impl<T: GcSafe + NullTrace + Copy> TraceImmutable for GcCell<T>[src]

See Trace documentation on the safety of mutation

We require NullTrace in order to set our internals

Auto Trait Implementations

impl<T> !RefUnwindSafe for GcCell<T>

impl<T> Send for GcCell<T> where
    T: Send

impl<T> !Sync for GcCell<T>

impl<T> Unpin for GcCell<T> where
    T: Unpin

impl<T> UnwindSafe for GcCell<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.