pub enum BspNode<Id: Copy + Eq + Ord> {
Leaf(Id),
Split {
orientation: Orientation,
left: Box<BspNode<Id>>,
right: Box<BspNode<Id>>,
ratio: Ratio,
},
}Expand description
A strict binary (BSP) split tree.
Each Split node divides its area into two children using an integer
ratio. Remainder isolation guarantees no dead zones:
sum(child widths) == parent width.
Variants§
Implementations§
Source§impl<Id: Copy + Eq + Ord> BspNode<Id>
impl<Id: Copy + Eq + Ord> BspNode<Id>
pub fn leaf(id: Id) -> Self
pub fn is_leaf(&self) -> bool
pub fn unwrap_leaf(&self) -> Option<Id>
pub fn subtree_any(&self, predicate: &mut impl FnMut(Id) -> bool) -> bool
pub fn all_leaf_ids(&self) -> Vec<Id>
pub fn layout(&self, area: LayoutRect) -> Vec<(Id, LayoutRect)>
pub fn insert_leaf( &mut self, target: Id, insert: Id, position: InsertPosition, area: LayoutRect, constraints: &SizeConstraints, ) -> Result<(), LayoutError>
pub fn apply_drag( &mut self, area: LayoutRect, path: &[bool], orientation: Orientation, delta: i16, constraints: &SizeConstraints, ) -> bool
pub fn remove_leaf(&mut self, id: Id) -> Result<(), LayoutError>
pub fn find_path(&self, target: Id) -> Option<Vec<bool>>
Trait Implementations§
Source§impl<Id: Copy + Eq + Ord> LayoutEngine<Id> for BspNode<Id>
impl<Id: Copy + Eq + Ord> LayoutEngine<Id> for BspNode<Id>
fn layout(&self, area: LayoutRect) -> Vec<(Id, LayoutRect)>
fn insert_leaf( &mut self, target: Id, insert: Id, position: InsertPosition, area: LayoutRect, constraints: &SizeConstraints, ) -> Result<(), LayoutError>
fn remove_leaf(&mut self, id: Id) -> Result<(), LayoutError>
fn all_leaf_ids(&self) -> Vec<Id>
fn subtree_any(&self, predicate: &mut impl FnMut(Id) -> bool) -> bool
fn apply_drag( &mut self, area: LayoutRect, path: &[usize], _index: usize, orientation: Orientation, delta: i16, constraints: &SizeConstraints, ) -> bool
Auto Trait Implementations§
impl<Id> Freeze for BspNode<Id>where
Id: Freeze,
impl<Id> RefUnwindSafe for BspNode<Id>where
Id: RefUnwindSafe,
impl<Id> Send for BspNode<Id>where
Id: Send,
impl<Id> Sync for BspNode<Id>where
Id: Sync,
impl<Id> Unpin for BspNode<Id>where
Id: Unpin,
impl<Id> UnsafeUnpin for BspNode<Id>where
Id: UnsafeUnpin,
impl<Id> UnwindSafe for BspNode<Id>where
Id: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more