pub struct StorageValueRef<'a> { /* private fields */ }
Expand description

An abstraction over local storage value.

Implementations

Create a new reference to a value in the persistent local storage.

Create a new reference to a value in the fork-aware local storage.

Set the value of the storage to encoding of given parameter.

Note that the storage may be accessed by workers running concurrently, if you happen to write a get-check-set pattern you should most likely be using mutate instead.

Remove the associated value from the storage.

Retrieve & decode the value from storage.

Note that if you want to do some checks based on the value and write changes after that you should rather be using mutate.

The function returns None if the value was not found in storage, otherwise a decoding of the value to requested type.

Retrieve & decode the value and set it to a new one atomically.

Function f should return a new value that we should attempt to write to storage. This function returns:

  1. Ok(Ok(T)) in case the value has been successfully set.
  2. Ok(Err(T)) in case the value was calculated by the passed closure f, but it could not be stored.
  3. Err(_) in case f returns an error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert from a value of T into an equivalent instance of Option<Self>. Read more

Consume self to return Some equivalent value of Option<T>. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Should always be Self

Convert from a value of T into an equivalent instance of Self. Read more

Consume self to return an equivalent value of T. 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.

The counterpart to unchecked_from.

Consume self to return an equivalent value of T.