Skip to main content

PaneTree

Struct PaneTree 

Source
pub struct PaneTree { /* private fields */ }
Expand description

Validated pane tree model for runtime usage.

Implementations§

Source§

impl PaneTree

Source

pub fn singleton(surface_key: impl Into<String>) -> Self

Build a singleton tree with one root leaf.

Source

pub fn from_snapshot(snapshot: PaneTreeSnapshot) -> Result<Self, PaneModelError>

Construct and validate from a serial snapshot.

Source

pub fn to_snapshot(&self) -> PaneTreeSnapshot

Export to canonical snapshot form.

Source

pub const fn root(&self) -> PaneId

Root node ID.

Source

pub const fn next_id(&self) -> PaneId

Next deterministic ID value.

Source

pub const fn schema_version(&self) -> u16

Current schema version.

Source

pub fn node(&self, id: PaneId) -> Option<&PaneNodeRecord>

Lookup a node by ID.

Source

pub fn nodes(&self) -> impl Iterator<Item = &PaneNodeRecord>

Iterate nodes in canonical ID order.

Source

pub fn validate(&self) -> Result<(), PaneModelError>

Validate internal invariants.

Source

pub fn invariant_report(&self) -> PaneInvariantReport

Structured invariant diagnostics for the current tree snapshot.

Source

pub fn state_hash(&self) -> u64

Deterministic structural hash of the current tree state.

This is intended for operation logs and replay diagnostics.

Source

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.

Source

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.

Source

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.

Source

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)
Source

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.

Source

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.

Source

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.

Source

pub fn apply_reflow_move_plan( &mut self, operation_seed: u64, plan: &PaneReflowMovePlan, ) -> Result<Vec<PaneOperationOutcome>, PaneOperationError>

Apply a previously planned reflow move.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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:

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.

Source

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.

Source

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.

Source

pub fn apply_group_transform_plan( &mut self, operation_seed: u64, plan: &PaneGroupTransformPlan, ) -> Result<Vec<PaneOperationOutcome>, PaneOperationError>

Apply a group transform plan.

Source

pub fn plan_intelligence_mode( &self, mode: PaneLayoutIntelligenceMode, primary: PaneId, ) -> Result<Vec<PaneOperation>, PaneReflowPlanError>

Plan adaptive topology transitions using core split-tree operations.

Trait Implementations§

Source§

impl Clone for PaneTree

Source§

fn clone(&self) -> PaneTree

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PaneTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PaneTree

Source§

impl PartialEq for PaneTree

Source§

fn eq(&self, other: &PaneTree) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PaneTree

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.