Skip to main content

SuspendedFlow

Struct SuspendedFlow 

Source
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: u16

Section-local format version (see SUSPENDED_FLOW_SECTION_VERSION).

§current: DefinitionId

The 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: Value

Every 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: WakePolicy

The wake policy governing when the parked flow resumes (§2 point 4).

§next_block_id: u64

The 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

Source§

fn clone(&self) -> SuspendedFlow

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SuspendedFlow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SuspendedFlow

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SuspendedFlow

Source§

fn eq(&self, other: &SuspendedFlow) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for SuspendedFlow

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SuspendedFlow

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.