linera_client::persistent

Trait LocalPersist

Source
pub trait LocalPersist: Deref {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn as_mut(&mut self) -> &mut Self::Target;
    async fn persist(&mut self) -> Result<(), Self::Error>;
    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§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

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.

Source

async fn persist(&mut self) -> Result<(), Self::Error>

Saves the value to persistent storage.

Source

fn into_value(self) -> Self::Target
where Self::Target: Sized,

Takes the value out.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<TraitVariantBlanketType: Persist> LocalPersist for TraitVariantBlanketType

Source§

type Error = <TraitVariantBlanketType as Persist>::Error