pub struct GcRefCell<T: ?Sized + 'static> { /* private fields */ }Expand description
A mutable memory location with dynamically checked borrow rules that can be used inside of a garbage-collected pointer.
This object is a RefCell that can be used inside of a Gc<T>.
Implementations§
Source§impl<T> GcRefCell<T>
impl<T> GcRefCell<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the GcCell, returning the wrapped value.
Source§impl<T: ?Sized> GcRefCell<T>
impl<T: ?Sized> GcRefCell<T>
Sourcepub fn borrow(&self) -> GcRef<'_, T>
pub fn borrow(&self) -> GcRef<'_, T>
Immutably borrows the wrapped value.
The borrow lasts until the returned GcCellRef exits scope.
Multiple immutable borrows can be taken out at the same time.
§Panics
Panics if the value is currently mutably borrowed.
Sourcepub fn borrow_mut(&self) -> GcRefMut<'_, T>
pub fn borrow_mut(&self) -> GcRefMut<'_, T>
Mutably borrows the wrapped value.
The borrow lasts until the returned GcCellRefMut exits scope.
The value cannot be borrowed while this borrow is active.
§Panics
Panics if the value is currently borrowed.
Sourcepub fn try_borrow(&self) -> Result<GcRef<'_, T>, BorrowError>
pub fn try_borrow(&self) -> Result<GcRef<'_, T>, BorrowError>
Immutably borrows the wrapped value, returning an error if the value is currently mutably borrowed.
The borrow lasts until the returned GcCellRef exits scope. Multiple immutable borrows can be
taken out at the same time.
This is the non-panicking variant of borrow.
§Errors
Returns an Err if the value is currently mutably borrowed.
Sourcepub fn try_borrow_mut(&self) -> Result<GcRefMut<'_, T>, BorrowMutError>
pub fn try_borrow_mut(&self) -> Result<GcRefMut<'_, T>, BorrowMutError>
Mutably borrows the wrapped value, returning an error if the value is currently borrowed.
The borrow lasts until the returned GcCellRefMut exits scope.
The value cannot be borrowed while this borrow is active.
This is the non-panicking variant of borrow_mut.
§Errors
Returns an Err if the value is currently borrowed.
Trait Implementations§
impl<T: ?Sized + Eq> Eq for GcRefCell<T>
Source§impl<T: ?Sized + Ord> Ord for GcRefCell<T>
impl<T: ?Sized + Ord> Ord for GcRefCell<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: ?Sized + PartialOrd> PartialOrd for GcRefCell<T>
impl<T: ?Sized + PartialOrd> PartialOrd for GcRefCell<T>
impl<T: ?Sized + Send> Send for GcRefCell<T>
Source§impl<T: Trace + ?Sized> Trace for GcRefCell<T>
impl<T: Trace + ?Sized> Trace for GcRefCell<T>
Source§unsafe fn trace_non_roots(&self)
unsafe fn trace_non_roots(&self)
Source§fn run_finalizer(&self)
fn run_finalizer(&self)
Finalize::finalize on this object and all
contained subobjects.Auto Trait Implementations§
impl<T> !Freeze for GcRefCell<T>
impl<T> !RefUnwindSafe for GcRefCell<T>
impl<T> !Sync for GcRefCell<T>
impl<T> Unpin for GcRefCell<T>
impl<T> UnsafeUnpin for GcRefCell<T>
impl<T> UnwindSafe for GcRefCell<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more