Skip to main content
Snapshots are coming soon and not yet available in the current SDK.
See Snapshots for usage examples and patterns.

Sandbox methods


resume()

async fn resume(&self) -> MicrosandboxResult<()>
Resume the sandbox after a snapshot. The VM continues from exactly where it was paused.

snapshot()

async fn snapshot(&self) -> MicrosandboxResult<Snapshot>
Capture the full VM state: memory, CPU registers, filesystem, everything. The sandbox is paused during capture. Call resume() to continue running, or use the snapshot to fork new sandboxes. Returns
TypeDescription
SnapshotHandle to the captured state

Snapshot (instance)


restore()

async fn restore(&self, sandbox_name: impl Into<String>) -> MicrosandboxResult<Sandbox>
Fork a new sandbox from this snapshot. The new sandbox starts exactly where the original was when the snapshot was taken - no boot, no setup, no dependency install. Each fork gets its own copy-on-write filesystem. Parameters
NameTypeDescription
sandbox_nameimpl Into<String>Name for the new sandbox
Returns
TypeDescription
SandboxThe forked sandbox, ready to accept commands

restore_with()

async fn restore_with(&self, name: impl Into<String>, f: impl FnOnce(RestoreBuilder) -> RestoreBuilder) -> MicrosandboxResult<Sandbox>
Fork with configuration overrides. The VM state is restored from the snapshot, but the overridden settings (memory, CPUs, env vars) take effect on the new sandbox. Parameters
NameTypeDescription
nameimpl Into<String>Name for the new sandbox
fRestoreBuilderConfigure overrides (memory, cpus, env).
Returns
TypeDescription
SandboxThe forked sandbox with overrides applied

save_named()

async fn save_named(&self, name: &str) -> MicrosandboxResult<()>
Persist this snapshot under a name so it survives beyond the lifetime of the original sandbox. Named snapshots can be loaded later with Snapshot::get() to fork workers without keeping the base sandbox around. Parameters
NameTypeDescription
name&strSnapshot name (e.g. "after-pip-install")

Snapshot (static)


Snapshot::delete()

async fn delete(name: &str) -> MicrosandboxResult<()>
Delete a named snapshot from disk. Parameters
NameTypeDescription
name&strSnapshot name

Snapshot::get()

async fn get(name: &str) -> MicrosandboxResult<Snapshot>
Load a previously saved named snapshot. Parameters
NameTypeDescription
name&strSnapshot name
Returns
TypeDescription
SnapshotThe loaded snapshot

Snapshot::list()

async fn list() -> MicrosandboxResult<Vec<SnapshotInfo>>
List all saved named snapshots. Returns
TypeDescription
Vec<SnapshotInfo>All named snapshots