pub struct MutateGuard<T> { /* private fields */ }
Expand description

A handle to a writeable version of the data.

This structure is created by the mutate method on CloneReplace. The data held by the guard can be accessed via its Deref and DerefMut implementations.

When the guard is dropped, the contents will be written back to become the new reference version of the data. Any intermediate writes that occurred between the mutate guard being constructed and the writeback will be discarded.

Implementations

Discard the changes made in this mutation session.

The changed data will not be written back to its origin. If you do not call discard, the changes will always be committed when the guard goes out of scope.

Example:

use clone_replace::CloneReplace;

let c = CloneReplace::new(1);
let mut v = c.mutate();
*v = 2;
v.discard();
assert_eq!(*c.access(), 1);

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

A guard object containing the value and keeping it alive. Read more

The loading method. Read more

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

The equivalent of Access::load.

Returns the argument unchanged.

Calls U::from(self).

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.