pub struct PaneTree { /* private fields */ }Expand description
A tree of panes. Always contains at least one pane.
Implementations§
Source§impl PaneTree
impl PaneTree
pub fn new(root: PaneId) -> Self
pub fn root(&self) -> &Node
Sourcepub fn split(
&mut self,
target: PaneId,
axis: SplitDirection,
new_pane: PaneId,
new_first: bool,
) -> Option<SplitId>
pub fn split( &mut self, target: PaneId, axis: SplitDirection, new_pane: PaneId, new_first: bool, ) -> Option<SplitId>
Split the leaf holding target, placing new_pane beside it.
new_first puts the new pane left/top. Ratio starts at 0.5.
Returns the id of the created split, or None if target is absent
or new_pane is already present.
Sourcepub fn split_subtree(
&mut self,
target: PaneId,
axis: SplitDirection,
subtree: Node,
new_first: bool,
) -> bool
pub fn split_subtree( &mut self, target: PaneId, axis: SplitDirection, subtree: Node, new_first: bool, ) -> bool
Split the leaf holding target, placing an entire subtree beside it
(used when a whole tab — possibly itself split — is dropped onto a pane).
subtree’s SplitIds are renumbered into this tree so they can’t clash.
false if target is absent or subtree shares a pane with this tree.
Sourcepub fn remove(&mut self, pane: PaneId) -> bool
pub fn remove(&mut self, pane: PaneId) -> bool
Remove a pane, collapsing its parent split into the sibling subtree.
Returns false if the pane is absent or is the last pane.
Sourcepub fn set_ratio(&mut self, split: SplitId, ratio: f32) -> bool
pub fn set_ratio(&mut self, split: SplitId, ratio: f32) -> bool
Set a divider’s ratio (clamped to 0.1..=0.9). false if split is absent.
Sourcepub fn nearest_split(
&self,
pane: PaneId,
axis: SplitDirection,
) -> Option<SplitId>
pub fn nearest_split( &self, pane: PaneId, axis: SplitDirection, ) -> Option<SplitId>
The nearest ancestor split of pane whose divider runs along axis.
Used to resize the split adjacent to the focused pane in a direction.
Sourcepub fn list_dividers(&self) -> Vec<(SplitId, SplitDirection)>
pub fn list_dividers(&self) -> Vec<(SplitId, SplitDirection)>
All dividers in layout order (depth first, parent before children).
pub fn contains(&self, pane: PaneId) -> bool
Trait Implementations§
impl StructuralPartialEq for PaneTree
Auto Trait Implementations§
impl Freeze for PaneTree
impl RefUnwindSafe for PaneTree
impl Send for PaneTree
impl Sync for PaneTree
impl Unpin for PaneTree
impl UnsafeUnpin for PaneTree
impl UnwindSafe for PaneTree
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more