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.
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_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.