pub enum SplitLayout {
Pane(SplitPaneSpec),
Branch {
id: SharedString,
axis: SplitAxis,
ratio: f32,
start: Box<SplitLayout>,
end: Box<SplitLayout>,
},
}Expand description
A tree of splits the caller owns.
Variants§
Implementations§
Source§impl SplitLayout
impl SplitLayout
pub fn pane(id: impl Into<SharedString>) -> Self
pub fn leaf(spec: SplitPaneSpec) -> Self
pub fn split( id: impl Into<SharedString>, axis: SplitAxis, ratio: f32, start: SplitLayout, end: SplitLayout, ) -> Self
pub fn horizontal( id: impl Into<SharedString>, ratio: f32, start: SplitLayout, end: SplitLayout, ) -> Self
pub fn vertical( id: impl Into<SharedString>, ratio: f32, start: SplitLayout, end: SplitLayout, ) -> Self
pub fn id(&self) -> &SharedString
pub fn is_pane(&self) -> bool
Sourcepub fn panes(&self) -> Vec<&SplitPaneSpec>
pub fn panes(&self) -> Vec<&SplitPaneSpec>
Every leaf, in the order it is drawn.
Sourcepub fn find(&self, id: &str) -> Option<&SplitLayout>
pub fn find(&self, id: &str) -> Option<&SplitLayout>
The subtree named id, wherever it sits.
Sourcepub fn min_extent(&self, axis: SplitAxis) -> f32
pub fn min_extent(&self, axis: SplitAxis) -> f32
The smallest this subtree may be drawn at along axis, in pixels.
Sourcepub fn with_ratio(&self, split: &str, ratio: f32) -> Self
pub fn with_ratio(&self, split: &str, ratio: f32) -> Self
The same tree with one branch’s ratio replaced.
Sourcepub fn with_collapsed(&self, pane: &str, collapsed: bool) -> Self
pub fn with_collapsed(&self, pane: &str, collapsed: bool) -> Self
The same tree with one leaf’s collapsed flag replaced.
Sourcepub fn applied(&self, change: &SplitChange) -> Self
pub fn applied(&self, change: &SplitChange) -> Self
The same tree with a reported change applied.
This is offered so a host that simply accepts every change has one call to make. A host that judges them applies the ones it accepts itself.
Sourcepub fn to_records(&self) -> Vec<SplitRecord>
pub fn to_records(&self) -> Vec<SplitRecord>
The tree flattened into plain records, parents before children and the first child before the second.
Sourcepub fn from_records(records: &[SplitRecord]) -> Result<Self, SplitRecordError>
pub fn from_records(records: &[SplitRecord]) -> Result<Self, SplitRecordError>
Rebuilds a tree the host wrote out with SplitLayout::to_records.
Trait Implementations§
Source§impl Clone for SplitLayout
impl Clone for SplitLayout
Source§fn clone(&self) -> SplitLayout
fn clone(&self) -> SplitLayout
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SplitLayout
impl Debug for SplitLayout
Source§impl PartialEq for SplitLayout
impl PartialEq for SplitLayout
impl StructuralPartialEq for SplitLayout
Auto Trait Implementations§
impl Freeze for SplitLayout
impl RefUnwindSafe for SplitLayout
impl Send for SplitLayout
impl Sync for SplitLayout
impl Unpin for SplitLayout
impl UnsafeUnpin for SplitLayout
impl UnwindSafe for SplitLayout
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
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> 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> ⓘ
Converts
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> ⓘ
Converts
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