pub trait SnapshotCodec: Send + Sync {
// Required methods
fn format(&self) -> u8;
fn encode(
&self,
snapshot: Snapshot<'_>,
out: &mut Vec<u8>,
) -> Result<(), Error>;
fn decode(&self, record: &[u8]) -> Result<Value, Error>;
// Provided method
fn compact(&self) -> bool { ... }
}Expand description
Snapshots as records: XState’s SystemSnapshot (its JSON, or the
runtime’s view of it) to bytes, and bytes back to the JSON a restore
reads.
Required Methods§
Sourcefn format(&self) -> u8
fn format(&self) -> u8
The first byte of every record this codec writes, which tells its
records from other codecs’ (Codecs::decode_snapshot).
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".