Trait Persist

Source
pub trait Persist<'a>
where Self: Sized,
{ type State; type ConstructorArgs; type Error; // Required methods fn save(&self) -> Self::State; fn restore( constructor_args: Self::ConstructorArgs, state: &Self::State, ) -> Result<Self, Self::Error>; }
Expand description

An abstract interface for saving/restoring a component using a specific state.

Required Associated Types§

Source

type State

The type of the object representing the state of the component.

Source

type ConstructorArgs

The type of the object holding the constructor arguments.

Source

type Error

The type of the error that can occur while constructing the object.

Required Methods§

Source

fn save(&self) -> Self::State

Returns the current state of the component.

Source

fn restore( constructor_args: Self::ConstructorArgs, state: &Self::State, ) -> Result<Self, Self::Error>

Constructs a component from a specified state.

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§