snapshot

abstract fun snapshot(state: S): S

Returns an independent snapshot of state that SpeculativeSequencer can hold as the authoritative rollback origin.

For immutable state types (data classes, value types) the identity function { it } is safe. For mutable containers, return a deep copy.