pub struct Cell<T, const MP: usize, const MC: usize> { /* private fields */ }
Implementations§
Source§impl<T: Unpin, const MP: usize, const MC: usize> Cell<T, MP, MC>
impl<T: Unpin, const MP: usize, const MC: usize> Cell<T, MP, MC>
pub unsafe fn peek(&self) -> &T
Sourcepub fn try_get(&self) -> Result<Ref<'_, T, MP, MC>, Error<()>>
pub fn try_get(&self) -> Result<Ref<'_, T, MP, MC>, Error<()>>
Tries to get a reference to the value of the Cell.
Returns Err if the cell is uninitialized or in critical section.
Sourcepub fn get(&self) -> Get<'_, T, MP, MC> ⓘ
pub fn get(&self) -> Get<'_, T, MP, MC> ⓘ
Tries to get a reference to the value of the Cell.
Returns Err if the cell is uninitialized.
Sourcepub fn try_set(&self, val: T) -> Result<(), Error<T>>
pub fn try_set(&self, val: T) -> Result<(), Error<T>>
Sets the value of the Cell to the argument value.
Returns Err if the value is refered, initialized or in critical section.
Sourcepub fn set(&self, val: T) -> Set<'_, T, MP, MC> ⓘ
pub fn set(&self, val: T) -> Set<'_, T, MP, MC> ⓘ
Sets the value of the Cell to the argument value.
Returns Err if the value is refered or initialized.
Sourcepub fn try_take(&self) -> Result<Option<T>, Error<()>>
pub fn try_take(&self) -> Result<Option<T>, Error<()>>
Takes ownership of the current value, leaving the cell uninitialized.
Returns Err if the cell is refered or in critical section.
Sourcepub fn take(&self) -> Take<'_, T, MP, MC> ⓘ
pub fn take(&self) -> Take<'_, T, MP, MC> ⓘ
Takes ownership of the current value, leaving the cell uninitialized.
Sourcepub fn try_replace(&self, val: T) -> Result<Option<T>, Error<T>>
pub fn try_replace(&self, val: T) -> Result<Option<T>, Error<T>>
Replaces the contained value with value, and returns the old contained value.
Returns Err if the value is refered or in critical section.