[−][src]Struct zerogc::cell::GcCell
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]
Value: GcDirectBarrier<'gc, OwningRef> + Copy,
pub unsafe fn write_barrier(&self, owner: &OwningRef, field_offset: usize)
[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.
pub const NEEDS_TRACE: bool
[src]
pub fn visit<V: GcVisitor>(&mut self, visitor: &mut V) -> Result<(), V::Err>
[src]
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]
T: Send,
impl<T> !Sync for GcCell<T>
[src]
impl<T> Unpin for GcCell<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for GcCell<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,