pub struct NetDbSnapshot {
pub tasks: Option<(Vec<u8>, Option<u64>)>,
pub memories: Option<(Vec<u8>, Option<u64>)>,
}Expand description
Portable, postcard-serialisable bundle of per-model snapshots.
Returned by NetDb::snapshot; consumed by
NetDbBuilder::build_from_snapshot.
Fields§
§tasks: Option<(Vec<u8>, Option<u64>)>Some((bytes, last_seq)) if tasks were included in the DB
and have been snapshotted; None otherwise.
memories: Option<(Vec<u8>, Option<u64>)>Same, for memories.
Implementations§
Source§impl NetDbSnapshot
impl NetDbSnapshot
Sourcepub fn encode(&self) -> Result<Vec<u8>, NetDbError>
pub fn encode(&self) -> Result<Vec<u8>, NetDbError>
Serialize the whole bundle into a single postcard blob for persistence.
Sourcepub fn decode(bytes: &[u8]) -> Result<NetDbSnapshot, NetDbError>
pub fn decode(bytes: &[u8]) -> Result<NetDbSnapshot, NetDbError>
Deserialize from a blob produced by Self::encode.
Trait Implementations§
Source§impl Clone for NetDbSnapshot
impl Clone for NetDbSnapshot
Source§fn clone(&self) -> NetDbSnapshot
fn clone(&self) -> NetDbSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NetDbSnapshot
impl Debug for NetDbSnapshot
Source§impl<'de> Deserialize<'de> for NetDbSnapshot
impl<'de> Deserialize<'de> for NetDbSnapshot
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NetDbSnapshot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NetDbSnapshot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for NetDbSnapshot
impl Serialize for NetDbSnapshot
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for NetDbSnapshot
impl RefUnwindSafe for NetDbSnapshot
impl Send for NetDbSnapshot
impl Sync for NetDbSnapshot
impl Unpin for NetDbSnapshot
impl UnsafeUnpin for NetDbSnapshot
impl UnwindSafe for NetDbSnapshot
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