pub struct RefLock<T: ?Sized> { /* private fields */ }
Expand description
Implementations§
Source§impl<T: ?Sized> RefLock<T>
impl<T: ?Sized> RefLock<T>
pub fn as_ptr(&self) -> *mut T
pub fn borrow<'a>(&'a self) -> Ref<'a, T>
pub fn try_borrow<'a>(&'a self) -> Result<Ref<'a, T>, BorrowError>
Sourcepub unsafe fn as_ref_cell(&self) -> &RefCell<T>
pub unsafe fn as_ref_cell(&self) -> &RefCell<T>
Access the wrapped RefCell
.
§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 RefCell
, 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 + 'gc> Collect for RefLock<T>
impl<'gc, T: Collect + 'gc> Collect for RefLock<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 + ?Sized> Ord for RefLock<T>
impl<T: Ord + ?Sized> Ord for RefLock<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd + ?Sized> PartialOrd for RefLock<T>
impl<T: PartialOrd + ?Sized> PartialOrd for RefLock<T>
impl<T: Eq + ?Sized> Eq for RefLock<T>
impl<T: ?Sized> StructuralPartialEq for RefLock<T>
Auto Trait Implementations§
impl<T> !Freeze for RefLock<T>
impl<T> !RefUnwindSafe for RefLock<T>
impl<T> Send for RefLock<T>
impl<T> !Sync for RefLock<T>
impl<T> Unpin for RefLock<T>
impl<T> UnwindSafe for RefLock<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