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 manually
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: PartialOrd + Copy> PartialOrd for Lock<T>
impl<T: PartialOrd + Copy> PartialOrd for Lock<T>
impl<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