Trait Checkpointable

Source
pub trait Checkpointable:
    Send
    + Sync
    + Sized {
    type State: RemoteMessage;

    // Required methods
    fn save<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::State, CheckpointError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn load<'async_trait>(
        state: Self::State,
    ) -> Pin<Box<dyn Future<Output = Result<Self, CheckpointError>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

[Checkpoint] is used to save the state of an instance so that it can be restored later.

Required Associated Types§

Source

type State: RemoteMessage

The type of the state that is saved. The state can be serialized and deserialized from persistent storage.

Required Methods§

Source

fn save<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::State, CheckpointError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Saves the current state.

Source

fn load<'async_trait>( state: Self::State, ) -> Pin<Box<dyn Future<Output = Result<Self, CheckpointError>> + Send + 'async_trait>>
where Self: 'async_trait,

Loads the a state to restore the instance.

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<T> Checkpointable for T
where T: RemoteMessage + Clone,

Source§

type State = T