Skip to main content

Module plan

Module plan 

Source
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 unrepresentableLayoutPlan’s leaves hold PaneSlot, not PaneId.

Structs§

PaneSlot
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 PaneId is expected (and vice-versa): the two id spaces don’t mix.
SpawnSpec
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::TearPane field so the instantiate interpreter maps SpawnSpecTearPane directly.
WindowPlan
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§

LayoutPlan
The latent layout: structurally the binary-tree twin of LayoutNode, but its leaves hold PaneSlot (a definition-local key) instead of a live PaneId. A stored definition therefore references nothing runtime — the design’s deliberate choice over generifying the shipped LayoutNode<L> (which would churn its whole proptest suite + every call site). LayoutPlan::realize bridges the two id spaces.
PlanError
Why a LayoutPlan failed LayoutPlan::validate. Mirrors the shipped crate::LayoutError discipline for the plan’s id space (slots, not panes). A plan that fails to validate never reaches realize, so a malformed definition can’t produce a broken live tree.