#[non_exhaustive]pub enum DockLayout {
Split {
axis: DockAxis,
ratio: f32,
first: Box<DockLayout>,
second: Box<DockLayout>,
},
Tabs {
panels: Vec<String>,
shown: usize,
},
}Expand description
How a dock’s panels are arranged, naming panels by their keys
(DockPanel::with_key): what
DockArea::layout saves and DockArea::restore_layout puts back, for example when an
application starts again.
It is written as text (to_string()) and read back with str::parse:
densa-dock 1 (row 0.6 (tabs 0 "orders" "trades") (tabs 0 "chart")), a version then the
tree, each split with its axis (row: side by side, column: one above the other) and
the fraction its first part takes, each group with the position of its shown tab and
its panels’ keys (quoted, \" and \\ escaped). Splits nest:
densa-dock 1 (column 0.25 (tabs 0 "log") (row 0.6 (tabs 0 "chart") (tabs 0 "hosts")))
puts the log above, then the chart beside the hosts. A text that is not a layout is
refused with a DockLayoutError naming where and why. Layouts
built in code are written however deep they are, but only those within
MAX_LAYOUT_DEPTH read back.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Split
Two parts sharing a rectangle along axis; ratio (0 to 1) of it is the first’s.
Fields
first: Box<DockLayout>The left or upper part.
second: Box<DockLayout>The right or lower part.
Tabs
A group of tabs: its panels’ keys in tab order, and the position of the shown one.
Trait Implementations§
Source§impl Clone for DockLayout
impl Clone for DockLayout
Source§impl Debug for DockLayout
impl Debug for DockLayout
Source§impl Display for DockLayout
impl Display for DockLayout
Source§impl FromStr for DockLayout
impl FromStr for DockLayout
Source§fn from_str(text: &str) -> Result<Self, Self::Err>
fn from_str(text: &str) -> Result<Self, Self::Err>
Reads a layout written by to_string().
§Errors
DockLayoutError for another format or version, a ratio that is not a number from
0 to 1, a group without panels or showing a tab it lacks, splits nested deeper than
MAX_LAYOUT_DEPTH, or anything after the layout; see DockLayoutErrorKind.