Expand description
The latent layout plan — what a session definition stores, before it is instantiated into live panes.
A [crate::SessionDefinition] (in praça) needs to describe a layout
WITHOUT naming any live PaneId: a stored definition that
referenced a runtime pane id would be nonsense the moment the daemon
restarts and mints fresh ids. So the plan is layout-as-data over
PaneSlots — stable, definition-local keys — and the
LayoutPlan::realize morphism turns a plan into a live
LayoutNode by minting one PaneId per slot. After realize,
the whole shipped layout algebra (compute_rects, neighbor,
split_leaf, …) applies unchanged — the plan reuses, never
duplicates, the live tree.
This is the typed fix for the pressure-test’s illegal state #3: a
definition that carried no layout/panes/commands, so there was
nothing to instantiate. Here the layout and the per-pane spawn specs
are first-class, and a plan that references a live id is
unrepresentable — LayoutPlan’s leaves hold PaneSlot, not
PaneId.
Structs§
- Pane
Slot - A stable, definition-local pane slot key. Assigned at authoring time
(a small index), it identifies a pane within a definition — never a
live pane. The newtype means a slot can never be passed where a live
PaneIdis expected (and vice-versa): the two id spaces don’t mix. - Spawn
Spec - What to spawn in one slot when a definition is instantiated. This is
the per-pane data a stored definition must carry so a session can be
re-created (or re-instantiated after a restart) faithfully. Every
field mirrors the corresponding
crate::TearPanefield so theinstantiateinterpreter mapsSpawnSpec→TearPanedirectly. - Window
Plan - The latent mirror of a
crate::TearWindow: a named window with a layout plan and the slot that should be focused after instantiation. Stored inside a session definition; carries no runtime ids — a definition can hold several of these (multi-window sessions).
Enums§
- Layout
Plan - The latent layout: structurally the binary-tree twin of
LayoutNode, but its leaves holdPaneSlot(a definition-local key) instead of a livePaneId. A stored definition therefore references nothing runtime — the design’s deliberate choice over generifying the shippedLayoutNode<L>(which would churn its whole proptest suite + every call site).LayoutPlan::realizebridges the two id spaces. - Plan
Error - Why a
LayoutPlanfailedLayoutPlan::validate. Mirrors the shippedcrate::LayoutErrordiscipline for the plan’s id space (slots, not panes). A plan that fails to validate never reachesrealize, so a malformed definition can’t produce a broken live tree.