Skip to main content

Versioned

Trait Versioned 

Source
pub trait Versioned {
    const CURRENT_VERSION: u32;

    // Required methods
    fn version(&self) -> u32;
    fn set_version(&mut self, v: u32);
}
Expand description

A persisted struct whose schema is versioned.

CURRENT_VERSION is the version this build of the code reads and writes. Files on disk may be older — Migrator walks them up.

Required Associated Constants§

Source

const CURRENT_VERSION: u32

The version this build understands. Bump when the schema changes in a way that requires migration.

Required Methods§

Source

fn version(&self) -> u32

The version embedded in this instance.

Source

fn set_version(&mut self, v: u32)

Write a new version into this instance. Used by the migrator after a successful chain of steps.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: 'static> Versioned for ListFile<T>

T doesn’t carry a version itself; the wrapper does. This impl is parameterized on the version a particular app uses by way of the Versioned for ListFile<T> instance the app produces. We provide a default CURRENT_VERSION = 1; apps that bump the schema replace the impl via newtype.