pub struct Snapshot { /* private fields */ }
Expand description
The Snapshot
API manages serialization and deserialization of collections of objects
that implement the Versionize
trait.
Implementations§
Source§impl Snapshot
impl Snapshot
Sourcepub fn new(version_map: VersionMap, target_version: u16) -> Snapshot
pub fn new(version_map: VersionMap, target_version: u16) -> Snapshot
Creates a new instance which can only be used to save a new snapshot.
Sourcepub fn get_data_version<T>(
reader: &mut T,
version_map: &VersionMap,
) -> Result<u16, Error>
pub fn get_data_version<T>( reader: &mut T, version_map: &VersionMap, ) -> Result<u16, Error>
Fetches snapshot data version.
Sourcepub fn unchecked_load<T: Read + Debug, O: Versionize + Debug>(
reader: &mut T,
version_map: VersionMap,
) -> Result<(O, u16), Error>
pub fn unchecked_load<T: Read + Debug, O: Versionize + Debug>( reader: &mut T, version_map: VersionMap, ) -> Result<(O, u16), Error>
Attempts to load an existing snapshot without CRC validation.
Sourcepub fn load<T: Read + Debug, O: Versionize + Debug>(
reader: &mut T,
snapshot_len: usize,
version_map: VersionMap,
) -> Result<(O, u16), Error>
pub fn load<T: Read + Debug, O: Versionize + Debug>( reader: &mut T, snapshot_len: usize, version_map: VersionMap, ) -> Result<(O, u16), Error>
Attempts to load an existing snapshot and validate CRC.
Sourcepub fn save<T, O>(&mut self, writer: &mut T, object: &O) -> Result<(), Error>
pub fn save<T, O>(&mut self, writer: &mut T, object: &O) -> Result<(), Error>
Saves a snapshot and include a CRC64 checksum.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Snapshot
impl !RefUnwindSafe for Snapshot
impl Send for Snapshot
impl Sync for Snapshot
impl Unpin for Snapshot
impl !UnwindSafe for Snapshot
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