Skip to main content

ForkMachine

Trait ForkMachine 

Source
pub trait ForkMachine: Machine {
    // Required method
    fn fork(&self) -> Result<Box<dyn ForkMachine>>;
}
Expand description

Machines that can be forked into a live sibling: the fork starts from this machine’s environment, and the two diverge from there, sharing nothing the isolation law would notice.

This is not SnapshotMachine spelled differently. Restoring replaces a machine’s state, so one handle lives one timeline at a time; a fork leaves both alive, which is what exploring several contexts from one expensive start wants. A process that took seconds to load is forked once for each hypothesis, not reloaded for each. A solver’s push/pop is a snapshot and not a fork; an immutable environment, such as Lean’s, is both for free.

Required Methods§

Source

fn fork(&self) -> Result<Box<dyn ForkMachine>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ForkMachine for ScriptMachine

A ScriptMachine’s whole state is its history, so snapshots are exact and free: the replay model’s one honest advantage over a live process.