pub struct LoopSyncCellAccess<'cell, T> { /* private fields */ }Expand description
Accessor for a LoopSyncCell, that will automatically write back any modifications to T
when dropped (or manually committed), unless you deliberately disarm it with
LoopSyncCellAccess::consume to make it so the LoopSyncCell is “used up”.
Implementations§
Source§impl<'cell, T> LoopSyncCellAccess<'cell, T>
impl<'cell, T> LoopSyncCellAccess<'cell, T>
Sourcepub fn commit(self)
pub fn commit(self)
Consume the accessor and commit the changes made to the LoopSyncCell’s value, making the
value available once again to anyone trying to get it via LoopSyncCell::access. Equivalent
to mem::drop
Sourcepub fn consume(self) -> T
pub fn consume(self) -> T
Consume the accessor, but do not write the value to the LoopSyncCell. This will leave the
LoopSyncCell in such a state that it can no longer ever provide values.
This returns the value itself as-per it’s modifications.
Sourcepub fn into_mapped_access(self) -> LoopSyncCellMappedAccess<'cell, T, ()>
pub fn into_mapped_access(self) -> LoopSyncCellMappedAccess<'cell, T, ()>
Get a version of this capable of being mapped.
Sourcepub fn map_loopcell_access<O>(
self,
f: impl FnOnce(&mut T) -> O,
) -> LoopSyncCellMappedAccess<'cell, T, O>
pub fn map_loopcell_access<O>( self, f: impl FnOnce(&mut T) -> O, ) -> LoopSyncCellMappedAccess<'cell, T, O>
Directly map this bare LoopSyncCellAccess into one that is “mapped” to another value.
Sourcepub fn as_loopcell_value(&self) -> &T
pub fn as_loopcell_value(&self) -> &T
Get the value of the loopcell from the access
Sourcepub fn as_loopcell_value_mut(&mut self) -> &mut T
pub fn as_loopcell_value_mut(&mut self) -> &mut T
Get the value of the loopcell from the access, mutably.