Skip to content

snapshot

The snapshot module exposes a single suspension primitive that captures the current execution state, returns a hash identifier, and — when resumed — re-enters the call site indicating that a previous snapshot has been restored.

For richer VM-state introspection (frame capture, module bindings, content hashing, diff/patch), see std::core::state.

use std::core::snapshot
pub enum Snapshot {
Hash(string), // process was just snapshotted; payload is the Hash ID
Resumed, // execution resumed from a previous snapshot
}

Create a snapshot of the current execution state. The engine saves all state and returns Snapshot::Hash(id). When execution later resumes from that snapshot, control returns to the same call site and snapshot::snapshot() returns Snapshot::Resumed.

use std::core::snapshot
match snapshot::snapshot() {
Snapshot::Hash(id) => {
print(f"snapshot id: {id}")
// ... persist id, transfer to peer, etc.
},
Snapshot::Resumed => {
print("resumed from a prior snapshot")
// ... continue post-resume work
},
}