Struct atomic_refcell::AtomicRefCell
source · pub struct AtomicRefCell<T: ?Sized> { /* private fields */ }
Expand description
A threadsafe analogue to RefCell.
Implementations§
source§impl<T> AtomicRefCell<T>
impl<T> AtomicRefCell<T>
sourcepub const fn new(value: T) -> AtomicRefCell<T>
pub const fn new(value: T) -> AtomicRefCell<T>
Creates a new AtomicRefCell
containing value
.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the AtomicRefCell
, returning the wrapped value.
source§impl<T: ?Sized> AtomicRefCell<T>
impl<T: ?Sized> AtomicRefCell<T>
sourcepub fn try_borrow(&self) -> Result<AtomicRef<'_, T>, BorrowError>
pub fn try_borrow(&self) -> Result<AtomicRef<'_, T>, BorrowError>
Attempts to immutably borrow the wrapped value, but instead of panicking
on a failed borrow, returns Err
.
sourcepub fn borrow_mut(&self) -> AtomicRefMut<'_, T>
pub fn borrow_mut(&self) -> AtomicRefMut<'_, T>
Mutably borrows the wrapped value.
sourcepub fn try_borrow_mut(&self) -> Result<AtomicRefMut<'_, T>, BorrowMutError>
pub fn try_borrow_mut(&self) -> Result<AtomicRefMut<'_, T>, BorrowMutError>
Attempts to mutably borrow the wrapped value, but instead of panicking
on a failed borrow, returns Err
.
Trait Implementations§
source§impl<T: Clone> Clone for AtomicRefCell<T>
impl<T: Clone> Clone for AtomicRefCell<T>
source§fn clone(&self) -> AtomicRefCell<T>
fn clone(&self) -> AtomicRefCell<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Default> Default for AtomicRefCell<T>
impl<T: Default> Default for AtomicRefCell<T>
source§fn default() -> AtomicRefCell<T>
fn default() -> AtomicRefCell<T>
Returns the “default value” for a type. Read more
source§impl<T> From<T> for AtomicRefCell<T>
impl<T> From<T> for AtomicRefCell<T>
source§fn from(t: T) -> AtomicRefCell<T>
fn from(t: T) -> AtomicRefCell<T>
Converts to this type from the input type.
source§impl<T: ?Sized + PartialOrd> PartialOrd for AtomicRefCell<T>
impl<T: ?Sized + PartialOrd> PartialOrd for AtomicRefCell<T>
impl<T: ?Sized + Eq> Eq for AtomicRefCell<T>
impl<T: ?Sized + Send> Send for AtomicRefCell<T>
impl<T: ?Sized + Send + Sync> Sync for AtomicRefCell<T>
Auto Trait Implementations§
impl<T> !Freeze for AtomicRefCell<T>
impl<T> !RefUnwindSafe for AtomicRefCell<T>
impl<T> Unpin for AtomicRefCell<T>
impl<T> UnwindSafe for AtomicRefCell<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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)