pub struct SharedCell<T>(/* private fields */);Expand description
Strong, shared ownership of T with interior mutability.
Implementations§
Sourcepub fn borrow_mut(&self) -> RefMut<'_, T>
pub fn borrow_mut(&self) -> RefMut<'_, T>
Mutable borrow of the inner value.
Sourcepub fn try_borrow(&self) -> Result<Ref<'_, T>, BorrowError>
pub fn try_borrow(&self) -> Result<Ref<'_, T>, BorrowError>
Attempts to immutably borrow the inner value.
§Errors
Returns BorrowError if the value is currently mutably borrowed.
Sourcepub fn try_borrow_mut(&self) -> Result<RefMut<'_, T>, BorrowMutError>
pub fn try_borrow_mut(&self) -> Result<RefMut<'_, T>, BorrowMutError>
Attempts to mutably borrow the inner value.
§Errors
Returns BorrowMutError if the value is currently borrowed
(mutably or immutably).
Sourcepub fn strong_count(&self) -> usize
pub fn strong_count(&self) -> usize
Number of active strong references.
Sourcepub fn weak_count(&self) -> usize
pub fn weak_count(&self) -> usize
Number of active weak references.
Sourcepub fn as_ptr(&self) -> *const RefCell<T>
pub fn as_ptr(&self) -> *const RefCell<T>
Returns the raw pointer to the underlying cell, useful for identity diagnostics.
Trait Implementations§
Source§fn from(shared: SharedCell<T>) -> Self
fn from(shared: SharedCell<T>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.