pub enum LayoutNode {
Leaf(HarnessId),
Split {
axis: Axis,
ratio: f32,
first: Box<LayoutNode>,
second: Box<LayoutNode>,
},
}Expand description
Binary dwindle tree. Leaves reference harnesses that live in the same workspace; the tree only describes geometry.
Variants§
Implementations§
Source§impl LayoutNode
impl LayoutNode
pub fn leaf(id: HarnessId) -> Self
pub fn split( axis: Axis, ratio: f32, first: LayoutNode, second: LayoutNode, ) -> Self
pub fn leaves(&self) -> Vec<HarnessId>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn contains(&self, id: HarnessId) -> bool
pub fn first_leaf(&self) -> Option<HarnessId>
Sourcepub fn split_at(
&mut self,
target: HarnessId,
new: HarnessId,
zone: DropZone,
) -> bool
pub fn split_at( &mut self, target: HarnessId, new: HarnessId, zone: DropZone, ) -> bool
Insert new next to target, splitting in the requested direction.
Sourcepub fn swap(&mut self, a: HarnessId, b: HarnessId) -> bool
pub fn swap(&mut self, a: HarnessId, b: HarnessId) -> bool
Swap two leaves in place. Used for the center drop zone.
Sourcepub fn remove(&mut self, id: HarnessId) -> bool
pub fn remove(&mut self, id: HarnessId) -> bool
Remove a leaf, collapsing its parent split. Returns false for the root leaf; callers should keep at least one leaf alive.
Trait Implementations§
Source§impl Clone for LayoutNode
impl Clone for LayoutNode
Source§impl Debug for LayoutNode
impl Debug for LayoutNode
Source§impl<'de> Deserialize<'de> for LayoutNode
impl<'de> Deserialize<'de> for LayoutNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for LayoutNode
impl Freeze for LayoutNode
impl Move for LayoutNode
impl RefUnwindSafe for LayoutNode
impl Send for LayoutNode
impl Sync for LayoutNode
impl Unpin for LayoutNode
impl UnsafeUnpin for LayoutNode
impl UnwindSafe for LayoutNode
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