Skip to main content

Replayable

Trait Replayable 

Source
pub trait Replayable: 'static {
    type Edit: Serialize + DeserializeOwned;

    // Required methods
    fn apply(&mut self, edit: Self::Edit);
    fn snapshot(&self) -> Self::Edit;
    fn filename_prefix() -> &'static str;
    fn initial() -> Self;
}

Required Associated Types§

Source

type Edit: Serialize + DeserializeOwned

This atomic edit is serialized into the journal for later reconstruction via sequential replay.

Required Methods§

Source

fn apply(&mut self, edit: Self::Edit)

Apply another Self::Edit to the current state.

Source

fn snapshot(&self) -> Self::Edit

Calculate a new edit that can be used to reconstruct the current state. This is required to create the initial edit for file rotations.

Source

fn filename_prefix() -> &'static str

This prefix is used to create new files for rotation internally.

Source

fn initial() -> Self

Separated from Default, but usually has the same implementation, just as a semantic distinction.

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§