Skip to main content

Module flow

Module flow 

Source
Expand description

Ordered call/control flow of a function body: the raw material for sequence diagrams.

A Flow is a tree of Steps in source order. Calls are leaves; branches, loops and optional blocks are interior nodes that map one-to-one onto Mermaid alt / else, loop and opt fragments. Language adapters drop anything that contains no calls, so a flow is already the minimal skeleton of “who talks to whom, in what order, under which condition”.

Every Call::target is a canonical SymbolId. When the target is itself a callable in the codebase, its own flow is a separate fragment with the same id, which is what lets an orchestrator inline one sequence into another, or stitch fragments across files, without guessing.

use sealmap_model::*;

let open = SymbolId::parse("sym:cargo app . Db#open().").unwrap();
let insert = SymbolId::parse("sym:cargo app . Db#insert().").unwrap();
let flow = Flow::new(vec![
    Step::Call(Call::new(open, "open", Confidence::Exact)),
    Step::Loop {
        label: "for row in rows".into(),
        body: vec![Step::Call(Call::new(insert, "insert", Confidence::Inferred))],
    },
]);
assert_eq!(flow.call_count(), 2);
assert_eq!(flow.calls().map(|c| c.target.name()).collect::<Vec<_>>(), ["open", "insert"]);

Structs§

Arm
One arm of a Step::Branch or Step::Parallel.
Call
A single call site.
Exit
An early exit.
Flow
The ordered call/control skeleton of one callable body.

Enums§

CallKind
How a call is spelled at the call site.
Step
One node of a Flow.