LoopCellMappedAccess

Struct LoopCellMappedAccess 

Source
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>

Source

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.

Source

pub fn commit(self) -> V

Commit the changes made to the LoopCell through this accessor, making the LoopCell available to everyone once again with the new cell data, while also emitting the bundled value.

Source

pub fn consume(self) -> (T, V)

Consume the changes made to the LoopCell through this accessor, making the LoopCell never have any more values. This returns the last value of the LoopCell as modified by this accessor, as well as the bundled value.

Source

pub fn get_loopcell_value(&self) -> &T

Get the value of the loopcell from the access

Source

pub fn get_loopcell_value_mut(&mut self) -> &mut T

Get the value of the loopcell from the access, mutably.

Source

pub fn get_value(&self) -> &V

Get the bundled value from the access

Source

pub fn get_value_mut(&mut self) -> &mut V

Get the bundled value from the access, mutably.

Source

pub fn unmap_access(self) -> (LoopCellAccess<'cell, T>, V)

Unpack the bundled value from the normal LoopCellAccess

Trait Implementations§

Source§

impl<'cell, T, V> AsMut<V> for LoopCellMappedAccess<'cell, T, V>

Source§

fn as_mut(&mut self) -> &mut V

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<'cell, T, V> AsRef<V> for LoopCellMappedAccess<'cell, T, V>

Source§

fn as_ref(&self) -> &V

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'cell, T, V> Deref for LoopCellMappedAccess<'cell, T, V>

Source§

type Target = V

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'cell, T, V> DerefMut for LoopCellMappedAccess<'cell, T, V>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'cell, T, V: Default> From<LoopCellAccess<'cell, T>> for LoopCellMappedAccess<'cell, T, V>

Source§

fn from(bare_access: LoopCellAccess<'cell, T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'cell, T, V> Freeze for LoopCellMappedAccess<'cell, T, V>
where V: Freeze, T: Freeze,

§

impl<'cell, T, V = ()> !RefUnwindSafe for LoopCellMappedAccess<'cell, T, V>

§

impl<'cell, T, V = ()> !Send for LoopCellMappedAccess<'cell, T, V>

§

impl<'cell, T, V = ()> !Sync for LoopCellMappedAccess<'cell, T, V>

§

impl<'cell, T, V> Unpin for LoopCellMappedAccess<'cell, T, V>
where V: Unpin, T: Unpin,

§

impl<'cell, T, V = ()> !UnwindSafe for LoopCellMappedAccess<'cell, T, V>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.