pub struct VersionedWithCompat<T> {
pub schema_version: SchemaVersion,
pub data: T,
pub migration_notes: Vec<String>,
pub preserved: PreservedFields,
}Expand description
Enhanced versioned container with forward compatibility
Fields§
§schema_version: SchemaVersionSchema version of the data
data: TThe actual data
migration_notes: Vec<String>Migration notes (if data was migrated)
preserved: PreservedFieldsPreserved unknown fields for forward compatibility
Implementations§
Source§impl<T> VersionedWithCompat<T>
impl<T> VersionedWithCompat<T>
Sourcepub fn with_version(data: T, version: SchemaVersion) -> Self
pub fn with_version(data: T, version: SchemaVersion) -> Self
Create with specific version
Sourcepub fn add_migration_note(&mut self, note: String)
pub fn add_migration_note(&mut self, note: String)
Add migration note
Sourcepub fn needs_migration(&self) -> bool
pub fn needs_migration(&self) -> bool
Check if data needs migration
Sourcepub fn has_preserved_fields(&self) -> bool
pub fn has_preserved_fields(&self) -> bool
Check if there are preserved fields from a newer version
Trait Implementations§
Source§impl<T: Clone> Clone for VersionedWithCompat<T>
impl<T: Clone> Clone for VersionedWithCompat<T>
Source§fn clone(&self) -> VersionedWithCompat<T>
fn clone(&self) -> VersionedWithCompat<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for VersionedWithCompat<T>
impl<T: Debug> Debug for VersionedWithCompat<T>
Source§impl<'de, T> Deserialize<'de> for VersionedWithCompat<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for VersionedWithCompat<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
Auto Trait Implementations§
impl<T> Freeze for VersionedWithCompat<T>where
T: Freeze,
impl<T> RefUnwindSafe for VersionedWithCompat<T>where
T: RefUnwindSafe,
impl<T> Send for VersionedWithCompat<T>where
T: Send,
impl<T> Sync for VersionedWithCompat<T>where
T: Sync,
impl<T> Unpin for VersionedWithCompat<T>where
T: Unpin,
impl<T> UnwindSafe for VersionedWithCompat<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