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§
Sourceconst CURRENT_VERSION: u32
const CURRENT_VERSION: u32
The version this build understands. Bump when the schema changes in a way that requires migration.
Required Methods§
Sourcefn set_version(&mut self, v: u32)
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.
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.