pub struct SuspendedFlow {
pub version: u16,
pub current: DefinitionId,
pub return_stack: Vec<DefinitionId>,
pub frame: Value,
pub wake: WakePolicy,
pub next_block_id: u64,
pub pending_element: BTreeMap<String, String>,
}Expand description
The FlowFrame — a parked flow’s durable, recompile-stable representation
(docs/flow-suspension-spec.md §2, RULED). No instruction offsets ever
serialize; recompile-stability rides container/DefinitionId identity,
the same contract as the rest of SaveState, #@was, and fn tokens.
FS-1 is format-only: this type’s writer and reader are exercised today
only by round-trip tests (crates/internal/brink-format/tests/). The
compiler synthesis that populates Self::frame (FS-2) and the runtime
spill/restore that produces or consumes a live value (FS-3) are later
slices (docs/flow-suspension-spec.md §9).
Fields§
§version: u16Section-local format version (see SUSPENDED_FLOW_SECTION_VERSION).
current: DefinitionIdThe container the flow is currently parked inside (name-stable; §2 point 1).
return_stack: Vec<DefinitionId>The tunnel-return chain, outermost first (name-stable; §2 point 2). Depth-capped at the runtime layer (FS-3; §7 “recursive awaiting tunnels” — a park-depth limit, sibling of the VM step limit) — the format itself imposes no bound.
frame: ValueEvery local crossing a yield, name-keyed — a plain Value
(typically Value::map), serialized by the existing Value
encoders with no new wire representation (§2 point 3). Frame-shape
drift across a recompile (a tunnel’s crossing-locals set changes)
rides the standard name-keyed rehydration discipline — missing
field → default, extra field → dropped, renamed field → treated as
missing, each reported rather than silently swallowed. This is
tolerant decode, which is FS-3 runtime scope; FS-1’s job is making
sure the encoding is name-keyed (never positional) so that decode is
possible at all — see this module’s
suspended_flow_frame_drift_is_representable test.
wake: WakePolicyThe wake policy governing when the parked flow resumes (§2 point 4).
next_block_id: u64The flow’s next_block_id counter (brink_runtime’s
Flow::next_block_id, runtime-side) at the instant it was parked
(§2 point 5, #2108,
2026-08-05 ruling: “block metadata persists, and next_block_id
persists with it”). A parked flow’s block-run numbering must survive
the save/resume boundary — unlike an ordinary (non-suspended) save,
where the host re-enters at a known knot and a fresh 0 is harmless
because nothing compares an id across that boundary, a resumed
flow continues executing from the exact point it parked, so its
block-id sequence must continue rather than collide with fresh
numbering starting over. #[serde(default)]: a save predating this
field decodes as 0, identical to the pre-ruling behavior it
replaces.
pending_element: BTreeMap<String, String>The element-attachment metadata (@[convention(..., attach = X)],
#2108) accumulated on the run that was open at the instant this flow
parked — empty when no attach run was open (§2 point 5). A block is
not just lines: executable statements can interleave with an
attach-scoped dialogue run, so an await can suspend inside one
(Step::Suspended is not a BlockId run-terminator — see
brink_runtime::story::BlockId’s own doc). Persisting this alongside
Self::next_block_id is what lets a resumed flow keep attributing
the lines it emits after wake to the same speaker/attachment,
instead of the run’s data silently resetting to empty on resume — the
player-visible loss the ruling explicitly refused to ship.
#[serde(default)] (older save decodes as empty — no open run to
restore, matching pre-ruling behavior); skip_serializing_if keeps
the common case (no run open at park time) free of wire noise.
Trait Implementations§
Source§impl Clone for SuspendedFlow
impl Clone for SuspendedFlow
Source§fn clone(&self) -> SuspendedFlow
fn clone(&self) -> SuspendedFlow
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more