pub struct AtomicCell<T> { /* private fields */ }Expand description
A container to allow atomic access to the contained object
Implementations§
Source§impl<T: Send + Copy> AtomicCell<T>
impl<T: Send + Copy> AtomicCell<T>
Sourcepub fn borrow<'a>(&'a self, cs: CriticalSection<'a>) -> &'a Cell<T>
pub fn borrow<'a>(&'a self, cs: CriticalSection<'a>) -> &'a Cell<T>
Borrow a reference to the contained value
A critical section must be obtained by the called and provided
Sourcepub fn fetch_update(&self, f: impl FnMut(T) -> Option<T>) -> Result<T, T>
pub fn fetch_update(&self, f: impl FnMut(T) -> Option<T>) -> Result<T, T>
Perform atomic modification of the contained value
This operation will be performed in a critical section, so it will block all IRQs until the function returns.
Source§impl<T: Send> AtomicCell<T>
impl<T: Send> AtomicCell<T>
Source§impl<T: Send + Default> AtomicCell<T>
impl<T: Send + Default> AtomicCell<T>
Trait Implementations§
Source§impl<T: Default> Default for AtomicCell<T>
impl<T: Default> Default for AtomicCell<T>
Auto Trait Implementations§
impl<T> !Freeze for AtomicCell<T>
impl<T> !RefUnwindSafe for AtomicCell<T>
impl<T> Send for AtomicCell<T>where
T: Send,
impl<T> Sync for AtomicCell<T>where
T: Send,
impl<T> Unpin for AtomicCell<T>where
T: Unpin,
impl<T> UnwindSafe for AtomicCell<T>where
T: UnwindSafe,
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> 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>
Converts
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>
Converts
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