pub struct VersionedWrapper<T> {
pub version: String,
pub data: T,
}Expand description
A wrapper for serialized data that includes explicit version information.
This struct is used for persistence to ensure that the version of the data is always stored alongside the data itself.
Fields§
§version: StringThe semantic version of the data.
data: TThe actual data.
Implementations§
Source§impl<T> VersionedWrapper<T>
impl<T> VersionedWrapper<T>
Source§impl<T: Versioned> VersionedWrapper<T>
impl<T: Versioned> VersionedWrapper<T>
Sourcepub fn from_versioned(data: T) -> Self
pub fn from_versioned(data: T) -> Self
Creates a wrapper from a versioned value, automatically extracting its version.
Trait Implementations§
Source§impl<T: Clone> Clone for VersionedWrapper<T>
impl<T: Clone> Clone for VersionedWrapper<T>
Source§fn clone(&self) -> VersionedWrapper<T>
fn clone(&self) -> VersionedWrapper<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 VersionedWrapper<T>
impl<T: Debug> Debug for VersionedWrapper<T>
Source§impl<'de, T> Deserialize<'de> for VersionedWrapper<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for VersionedWrapper<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 VersionedWrapper<T>where
T: Freeze,
impl<T> RefUnwindSafe for VersionedWrapper<T>where
T: RefUnwindSafe,
impl<T> Send for VersionedWrapper<T>where
T: Send,
impl<T> Sync for VersionedWrapper<T>where
T: Sync,
impl<T> Unpin for VersionedWrapper<T>where
T: Unpin,
impl<T> UnwindSafe for VersionedWrapper<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