Struct dbs_snapshot::Snapshot
source · 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 !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