pub struct PaneTree { /* private fields */ }Expand description
Validated pane tree model for runtime usage.
Implementations§
Source§impl PaneTree
impl PaneTree
Sourcepub fn singleton(surface_key: impl Into<String>) -> Self
pub fn singleton(surface_key: impl Into<String>) -> Self
Build a singleton tree with one root leaf.
Sourcepub fn from_snapshot(snapshot: PaneTreeSnapshot) -> Result<Self, PaneModelError>
pub fn from_snapshot(snapshot: PaneTreeSnapshot) -> Result<Self, PaneModelError>
Construct and validate from a serial snapshot.
Sourcepub fn to_snapshot(&self) -> PaneTreeSnapshot
pub fn to_snapshot(&self) -> PaneTreeSnapshot
Export to canonical snapshot form.
Sourcepub const fn schema_version(&self) -> u16
pub const fn schema_version(&self) -> u16
Current schema version.
Sourcepub fn node(&self, id: PaneId) -> Option<&PaneNodeRecord>
pub fn node(&self, id: PaneId) -> Option<&PaneNodeRecord>
Lookup a node by ID.
Sourcepub fn nodes(&self) -> impl Iterator<Item = &PaneNodeRecord>
pub fn nodes(&self) -> impl Iterator<Item = &PaneNodeRecord>
Iterate nodes in canonical ID order.
Sourcepub fn validate(&self) -> Result<(), PaneModelError>
pub fn validate(&self) -> Result<(), PaneModelError>
Validate internal invariants.
Sourcepub fn invariant_report(&self) -> PaneInvariantReport
pub fn invariant_report(&self) -> PaneInvariantReport
Structured invariant diagnostics for the current tree snapshot.
Sourcepub fn state_hash(&self) -> u64
pub fn state_hash(&self) -> u64
Deterministic structural hash of the current tree state.
This is intended for operation logs and replay diagnostics.
Sourcepub fn begin_transaction(&self, transaction_id: u64) -> PaneTransaction
pub fn begin_transaction(&self, transaction_id: u64) -> PaneTransaction
Start a transaction boundary for one or more structural operations.
Transactions stage mutations on a cloned working tree and provide a deterministic operation journal for replay, undo/redo, and auditing.
Sourcepub fn apply_operation(
&mut self,
operation_id: u64,
operation: PaneOperation,
) -> Result<PaneOperationOutcome, PaneOperationError>
pub fn apply_operation( &mut self, operation_id: u64, operation: PaneOperation, ) -> Result<PaneOperationOutcome, PaneOperationError>
Apply one structural operation atomically.
The operation is executed on a cloned working tree. On success, the
mutated clone replaces self; on failure, self is unchanged.
Operations in the PaneOperationFamily::Local family take a certified
fast path (in-place atomic mutation + local-closure validation) that is
proven equivalent to the conservative baseline in
tests/pane_operation_family_equivalence.rs. To bypass every fast path
and force the conservative whole-tree baseline, use
PaneTree::apply_operation_conservative.
Sourcepub fn apply_operation_conservative(
&mut self,
operation_id: u64,
operation: PaneOperation,
) -> Result<PaneOperationOutcome, PaneOperationError>
pub fn apply_operation_conservative( &mut self, operation_id: u64, operation: PaneOperation, ) -> Result<PaneOperationOutcome, PaneOperationError>
Apply one structural operation using the conservative baseline path.
This always clones a working tree and runs the whole-tree validator
regardless of PaneOperationFamily, bypassing every certified fast
path. It is the easy-to-force conservative validator for diagnosis,
rollback, and rollout, and serves as the differential oracle that the
Local fast paths are proven equivalent to. Semantics (accept/reject and
resulting tree) are identical to PaneTree::apply_operation; only the
execution and validation cost differ.
Sourcepub fn solve_layout(&self, area: Rect) -> Result<PaneLayout, PaneModelError>
pub fn solve_layout(&self, area: Rect) -> Result<PaneLayout, PaneModelError>
Solve the split-tree into concrete rectangles for the provided viewport.
Deterministic tie-break rule:
- Desired split size is
floor(available * ratio). - If clamping is required by constraints, we clamp into the feasible interval for the first child; remainder goes to the second child.
Complexity:
- Time:
O(node_count)(single DFS over split tree) - Space:
O(node_count)(output rectangle map)
Sourcepub fn choose_dock_preview(
&self,
layout: &PaneLayout,
pointer: PanePointerPosition,
magnetic_field_cells: f64,
) -> Option<PaneDockPreview>
pub fn choose_dock_preview( &self, layout: &PaneLayout, pointer: PanePointerPosition, magnetic_field_cells: f64, ) -> Option<PaneDockPreview>
Pick the best magnetic docking preview at a pointer location.
Sourcepub fn ranked_dock_previews_with_motion(
&self,
layout: &PaneLayout,
pointer: PanePointerPosition,
motion: PaneMotionVector,
magnetic_field_cells: f64,
excluded: Option<PaneId>,
limit: usize,
) -> Vec<PaneDockPreview>
pub fn ranked_dock_previews_with_motion( &self, layout: &PaneLayout, pointer: PanePointerPosition, motion: PaneMotionVector, magnetic_field_cells: f64, excluded: Option<PaneId>, limit: usize, ) -> Vec<PaneDockPreview>
Return top-ranked magnetic docking candidates (best-first) using motion-aware intent weighting.
Sourcepub fn plan_reflow_move_with_preview(
&self,
source: PaneId,
layout: &PaneLayout,
pointer: PanePointerPosition,
motion: PaneMotionVector,
inertial: Option<PaneInertialThrow>,
magnetic_field_cells: f64,
) -> Result<PaneReflowMovePlan, PaneReflowPlanError>
pub fn plan_reflow_move_with_preview( &self, source: PaneId, layout: &PaneLayout, pointer: PanePointerPosition, motion: PaneMotionVector, inertial: Option<PaneInertialThrow>, magnetic_field_cells: f64, ) -> Result<PaneReflowMovePlan, PaneReflowPlanError>
Plan a pane move with inertial projection, magnetic docking, and pressure-sensitive snapping.
Sourcepub fn apply_reflow_move_plan(
&mut self,
operation_seed: u64,
plan: &PaneReflowMovePlan,
) -> Result<Vec<PaneOperationOutcome>, PaneOperationError>
pub fn apply_reflow_move_plan( &mut self, operation_seed: u64, plan: &PaneReflowMovePlan, ) -> Result<Vec<PaneOperationOutcome>, PaneOperationError>
Apply a previously planned reflow move.
Sourcepub fn plan_edge_resize(
&self,
leaf: PaneId,
layout: &PaneLayout,
grip: PaneResizeGrip,
pointer: PanePointerPosition,
pressure: PanePressureSnapProfile,
) -> Result<PaneEdgeResizePlan, PaneEdgeResizePlanError>
pub fn plan_edge_resize( &self, leaf: PaneId, layout: &PaneLayout, grip: PaneResizeGrip, pointer: PanePointerPosition, pressure: PanePressureSnapProfile, ) -> Result<PaneEdgeResizePlan, PaneEdgeResizePlanError>
Plan any-edge / any-corner organic resize for one leaf.
Sourcepub fn apply_edge_resize_plan(
&mut self,
operation_seed: u64,
plan: &PaneEdgeResizePlan,
) -> Result<Vec<PaneOperationOutcome>, PaneOperationError>
pub fn apply_edge_resize_plan( &mut self, operation_seed: u64, plan: &PaneEdgeResizePlan, ) -> Result<Vec<PaneOperationOutcome>, PaneOperationError>
Apply all operations generated by an edge/corner resize plan.
Sourcepub fn plan_splitter_resize(
&self,
target: PaneResizeTarget,
layout: &PaneLayout,
pointer: PanePointerPosition,
pressure: PanePressureSnapProfile,
) -> Result<PaneOperation, PaneSplitterResizePlanError>
pub fn plan_splitter_resize( &self, target: PaneResizeTarget, layout: &PaneLayout, pointer: PanePointerPosition, pressure: PanePressureSnapProfile, ) -> Result<PaneOperation, PaneSplitterResizePlanError>
Plan a split-ratio operation for a directly-addressed splitter target from one pointer sample.
This is the splitter-handle analogue of PaneTree::plan_edge_resize:
where plan_edge_resize walks from a leaf to its nearest ancestor split,
this resizes the split named by PaneResizeTarget directly. The pointer
position is projected onto the split’s axis (with the same elastic edge
resistance and pressure-tuned snapping used by edge resize) to derive the
new first-child share. It is the pointer-drag primitive consumed by
PaneTree::operations_for_transition.
Sourcepub fn plan_splitter_nudge(
&self,
target: PaneResizeTarget,
delta_bps: i32,
) -> Result<PaneOperation, PaneSplitterResizePlanError>
pub fn plan_splitter_nudge( &self, target: PaneResizeTarget, delta_bps: i32, ) -> Result<PaneOperation, PaneSplitterResizePlanError>
Plan a discrete split-ratio nudge for a directly-addressed splitter target.
The split’s current ratio is stepped by delta_bps: positive values
grow the first child, negative values grow the second. This realizes
keyboard- and wheel-driven resize transitions, which carry no pointer
geometry and instead advance the existing ratio.
Sourcepub fn operations_for_transition(
&self,
transition: &PaneDragResizeTransition,
layout: &PaneLayout,
pressure: PanePressureSnapProfile,
) -> Vec<PaneOperation>
pub fn operations_for_transition( &self, transition: &PaneDragResizeTransition, layout: &PaneLayout, pressure: PanePressureSnapProfile, ) -> Vec<PaneOperation>
Bridge one drag/resize state-machine transition into the pane operations that realize it against this tree.
This is the connective tissue between host input adapters — the terminal
PaneTerminalAdapter and the web pointer-capture adapter — and live
PaneTree mutation. Adapters emit PaneDragResizeTransition values;
this method converts each geometry-bearing effect into PaneOperations
ready for PaneTree::apply_operation:
DragStarted/DragUpdated/Committed→ pointer-derivedPaneTree::plan_splitter_resizeat the effect’s current/end position.KeyboardApplied/WheelApplied→PaneTree::plan_splitter_nudgestepping byPANE_SNAP_DEFAULT_STEP_BPSper unit/line.
Non-geometric transitions (Armed, Canceled, Noop) and targets that
can no longer be resolved against layout (for example a split removed
since the gesture began) yield an empty vector. For diagnostics on
resolution failures, call PaneTree::plan_splitter_resize /
PaneTree::plan_splitter_nudge directly.
Sourcepub fn plan_group_move(
&self,
selection: &PaneSelectionState,
layout: &PaneLayout,
pointer: PanePointerPosition,
motion: PaneMotionVector,
inertial: Option<PaneInertialThrow>,
magnetic_field_cells: f64,
) -> Result<PaneGroupTransformPlan, PaneReflowPlanError>
pub fn plan_group_move( &self, selection: &PaneSelectionState, layout: &PaneLayout, pointer: PanePointerPosition, motion: PaneMotionVector, inertial: Option<PaneInertialThrow>, magnetic_field_cells: f64, ) -> Result<PaneGroupTransformPlan, PaneReflowPlanError>
Plan a cluster move by moving the anchor and then reattaching members.
Sourcepub fn plan_group_resize(
&self,
selection: &PaneSelectionState,
layout: &PaneLayout,
grip: PaneResizeGrip,
pointer: PanePointerPosition,
pressure: PanePressureSnapProfile,
) -> Result<PaneGroupTransformPlan, PaneEdgeResizePlanError>
pub fn plan_group_resize( &self, selection: &PaneSelectionState, layout: &PaneLayout, grip: PaneResizeGrip, pointer: PanePointerPosition, pressure: PanePressureSnapProfile, ) -> Result<PaneGroupTransformPlan, PaneEdgeResizePlanError>
Plan a cluster resize by resizing the shared outer boundary while preserving internal cluster ratios.
Sourcepub fn apply_group_transform_plan(
&mut self,
operation_seed: u64,
plan: &PaneGroupTransformPlan,
) -> Result<Vec<PaneOperationOutcome>, PaneOperationError>
pub fn apply_group_transform_plan( &mut self, operation_seed: u64, plan: &PaneGroupTransformPlan, ) -> Result<Vec<PaneOperationOutcome>, PaneOperationError>
Apply a group transform plan.
Sourcepub fn plan_intelligence_mode(
&self,
mode: PaneLayoutIntelligenceMode,
primary: PaneId,
) -> Result<Vec<PaneOperation>, PaneReflowPlanError>
pub fn plan_intelligence_mode( &self, mode: PaneLayoutIntelligenceMode, primary: PaneId, ) -> Result<Vec<PaneOperation>, PaneReflowPlanError>
Plan adaptive topology transitions using core split-tree operations.