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

#[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[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<T: GcSafe + Copy> GcSafe for GcCell<T>[src]

pub 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>[src]

impl<T> Send for GcCell<T> where
    T: Send
[src]

impl<T> !Sync for GcCell<T>[src]

impl<T> Unpin for GcCell<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for GcCell<T> where
    T: UnwindSafe
[src]

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.