pub struct LoopCellMappedAccess<'cell, T, V = ()> { /* private fields */ }Expand description
Accessor for a LoopCell, that will automatically write back any modifications to the value
on drop (unless disarmed with LoopCellMappedAccess::consume) so the LoopCell is “used
up”.
Unlike LoopCellAccess, this contains an extra value, and lets you perform modifications to
it with the “context” of the loop cell accessor (which is mutable).
This provides a clean way to bundle an accessor and also bundle a data value, which should be processed with the accessor.
Implementations§
Source§impl<'cell, T, V> LoopCellMappedAccess<'cell, T, V>
impl<'cell, T, V> LoopCellMappedAccess<'cell, T, V>
Sourcepub fn map_loopcell_access<O>(
self,
f: impl FnOnce(&mut T, V) -> O,
) -> LoopCellMappedAccess<'cell, T, O>
pub fn map_loopcell_access<O>( self, f: impl FnOnce(&mut T, V) -> O, ) -> LoopCellMappedAccess<'cell, T, O>
Apply a function to the mapped value, to produce a new mapped value - but it also makes the inner loop cell value that we have access to available.
Sourcepub fn get_loopcell_value(&self) -> &T
pub fn get_loopcell_value(&self) -> &T
Get the value of the loopcell from the access
Sourcepub fn get_loopcell_value_mut(&mut self) -> &mut T
pub fn get_loopcell_value_mut(&mut self) -> &mut T
Get the value of the loopcell from the access, mutably.
Sourcepub fn get_value_mut(&mut self) -> &mut V
pub fn get_value_mut(&mut self) -> &mut V
Get the bundled value from the access, mutably.
Sourcepub fn unmap_access(self) -> (LoopCellAccess<'cell, T>, V)
pub fn unmap_access(self) -> (LoopCellAccess<'cell, T>, V)
Unpack the bundled value from the normal LoopCellAccess