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)