Struct LoopCellAccess

Source
pub struct LoopCellAccess<'cell, T> { /* private fields */ }
Expand description

Accessor for a LoopCell, that will automatically write back any modifications to T when dropped (or manually committed), unless you deliberately disarm it with LoopCellAccess::consume to make it so the LoopCell is “used up”.

The Send-equivalent form is LoopSyncCellAccess

Implementations§

Source§

impl<'cell, T> LoopCellAccess<'cell, T>

Source

pub fn commit(self)

Consume the accessor and commit the changes made to the LoopCell’s value, making the value available once again to anyone trying to get it via LoopCell::access. Equivalent to mem::drop

Source

pub fn consume(self) -> T

Consume the accessor, but do not write the value to the LoopCell. This will leave the LoopCell in such a state that it can no longer ever provide values.

This returns the value itself as-per it’s modifications.

Source

pub fn into_mapped_access(self) -> LoopCellMappedAccess<'cell, T, ()>

Get a version of this capable of being mapped.

Source

pub fn map_loopcell_access<O>( self, f: impl FnOnce(&mut T) -> O, ) -> LoopCellMappedAccess<'cell, T, O>

Directly map this bare LoopCellAccess into one that is “mapped” to another value.

Source

pub fn as_loopcell_value(&self) -> &T

Get the value of the loopcell from the access

Source

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

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

Trait Implementations§

Source§

impl<'cell, T> AsMut<T> for LoopCellAccess<'cell, T>

Source§

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

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

impl<'cell, T> AsRef<T> for LoopCellAccess<'cell, T>

Source§

fn as_ref(&self) -> &T

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

impl<'cell, T: Debug> Debug for LoopCellAccess<'cell, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'cell, T> Deref for LoopCellAccess<'cell, T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<'cell, T> DerefMut for LoopCellAccess<'cell, T>

Source§

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

Mutably dereferences the value.
Source§

impl<'cell, T> Drop for LoopCellAccess<'cell, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
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> Freeze for LoopCellAccess<'cell, T>
where T: Freeze,

§

impl<'cell, T> !RefUnwindSafe for LoopCellAccess<'cell, T>

§

impl<'cell, T> !Send for LoopCellAccess<'cell, T>

§

impl<'cell, T> !Sync for LoopCellAccess<'cell, T>

§

impl<'cell, T> Unpin for LoopCellAccess<'cell, T>
where T: Unpin,

§

impl<'cell, T> !UnwindSafe for LoopCellAccess<'cell, T>

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.