pub struct Lock<T: ?Sized> { /* private fields */ }
Expand description
Implementations§
source§impl<T: ?Sized> Lock<T>
impl<T: ?Sized> Lock<T>
pub fn as_ptr(&self) -> *mut T
sourcepub unsafe fn as_cell(&self) -> &Cell<T>
pub unsafe fn as_cell(&self) -> &Cell<T>
Access the wrapped Cell
.
§Safety
In order to maintain the invariants of the garbage collector, no new Gc
pointers may be adopted by this type as a result of the interior mutability
afforded by directly accessing the inner Cell
, unless the write barrier for the containing Gc
pointer is invoked manuall
before collection is triggered.
pub fn get_mut(&mut self) -> &mut T
Trait Implementations§
source§impl<'gc, T: Collect + Copy + 'gc> Collect for Lock<T>
impl<'gc, T: Collect + Copy + 'gc> Collect for Lock<T>
source§fn needs_trace() -> bool
fn needs_trace() -> bool
As an optimization, if this type can never hold a
Gc
pointer and trace
is unnecessary
to call, you may implement this method and return false. The default implementation returns
true, signaling that Collect::trace
must be called.source§fn trace(&self, cc: &Collection)
fn trace(&self, cc: &Collection)
Must call
Collect::trace
on all held Gc
pointers. If this type holds inner types that
implement Collect
, a valid implementation would simply call Collect::trace
on all the
held values to ensure this.source§impl<T: Ord + Copy> Ord for Lock<T>
impl<T: Ord + Copy> Ord for Lock<T>
source§impl<T: PartialEq + Copy> PartialEq for Lock<T>
impl<T: PartialEq + Copy> PartialEq for Lock<T>
source§impl<T: PartialOrd + Copy> PartialOrd for Lock<T>
impl<T: PartialOrd + Copy> PartialOrd for Lock<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<T: Eq + Copy> Eq for Lock<T>
Auto Trait Implementations§
impl<T> !Freeze for Lock<T>
impl<T> !RefUnwindSafe for Lock<T>
impl<T> Send for Lock<T>
impl<T> !Sync for Lock<T>
impl<T> Unpin for Lock<T>
impl<T> UnwindSafe for Lock<T>where
T: UnwindSafe + ?Sized,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more