pub struct ListFile<T> {
pub version: u32,
pub items: Vec<T>,
}Expand description
On-disk shape for a persisted list: a versioned wrapper around
Vec<T>. Apps write migrations against this type, not the bare Vec.
Fields§
§version: u32Schema version, matched against Versioned::CURRENT_VERSION on
load to run any registered migrations before deserialization.
items: Vec<T>The ordered list of items as stored on disk.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for ListFile<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ListFile<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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.
Source§const CURRENT_VERSION: u32 = 1
const CURRENT_VERSION: u32 = 1
The version this build understands. Bump when the schema changes
in a way that requires migration.
Source§fn 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.
Auto Trait Implementations§
impl<T> Freeze for ListFile<T>
impl<T> RefUnwindSafe for ListFile<T>where
T: RefUnwindSafe,
impl<T> Send for ListFile<T>where
T: Send,
impl<T> Sync for ListFile<T>where
T: Sync,
impl<T> Unpin for ListFile<T>where
T: Unpin,
impl<T> UnsafeUnpin for ListFile<T>
impl<T> UnwindSafe for ListFile<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more