Trait linera_client::persistent::Persist
source · pub trait Persist: Deref + Send {
type Error: Error + Send + Sync + 'static;
// Required methods
fn as_mut(&mut self) -> &mut Self::Target;
fn persist(
&mut self,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn into_value(self) -> Self::Target
where Self::Target: Sized;
}
Expand description
The Persist
trait provides a wrapper around a value that can be saved in a
persistent way. A minimal implementation provides an Error
type, a persist
function to persist the value, and an as_mut
function to get a mutable reference to
the value in memory.
LocalPersist
is a non-Send
version.
Required Associated Types§
Required Methods§
sourcefn as_mut(&mut self) -> &mut Self::Target
fn as_mut(&mut self) -> &mut Self::Target
Gets a mutable reference to the value. This is not expressed as a
DerefMut
bound because it is discouraged to use this
function! Instead, use mutate
.
sourcefn persist(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send
fn persist(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send
Saves the value to persistent storage.
sourcefn into_value(self) -> Self::Target
fn into_value(self) -> Self::Target
Takes the value out.
Object Safety§
This trait is not object safe.