Struct zerogc::cell::GcCell [−][src]
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]
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]
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;
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
Trait Implementations
impl<'gc, OwningRef, Value> GcDirectBarrier<'gc, OwningRef> for GcCell<Value> where
Value: GcDirectBarrier<'gc, OwningRef> + Copy,
[src]
impl<'gc, OwningRef, Value> GcDirectBarrier<'gc, OwningRef> for GcCell<Value> where
Value: GcDirectBarrier<'gc, OwningRef> + Copy,
[src]unsafe fn write_barrier(&self, owner: &OwningRef, field_offset: usize)
[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]
impl<'min, T, Id> GcErase<'min, Id> for GcCell<T> where
T: Trace + Copy + GcErase<'min, Id>,
Id: CollectorId,
T::Erased: Copy + Trace,
[src]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]
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]impl<T: GcSafe + Copy> GcSafe for GcCell<T>
[src]
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: Trace + Copy> Trace 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.
Auto Trait Implementations
impl<T> !RefUnwindSafe for GcCell<T>
impl<T> !RefUnwindSafe for GcCell<T>
impl<T> UnwindSafe for GcCell<T> where
T: UnwindSafe,
impl<T> UnwindSafe for GcCell<T> where
T: UnwindSafe,
Blanket Implementations
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]pub fn borrow(&self) -> &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]
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;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_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]
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;