Skip to main content

Layout

Struct Layout 

Source
pub struct Layout { /* private fields */ }
Expand description

An immutable, validated layout ready for resolution.

Implementations§

Source§

impl Layout

Source

pub fn tree(&self) -> &LayoutTree

Borrow the underlying tree for read-only traversal.

Source

pub fn window_size(&self) -> usize

How many panels the active window shows at once.

Source

pub fn resolve( &self, width: f32, height: f32, ) -> Result<ResolvedLayout, PaneError>

Compile, compute, and resolve the layout at the given viewport size.

Source

pub fn build_row( f: impl FnOnce(&mut ContainerCtx<'_>), ) -> Result<Self, PaneError>

Build a row layout from a closure.

Source

pub fn build_col( f: impl FnOnce(&mut ContainerCtx<'_>), ) -> Result<Self, PaneError>

Build a column layout from a closure.

Source

pub fn build_row_gap( gap: f32, f: impl FnOnce(&mut ContainerCtx<'_>), ) -> Result<Self, PaneError>

Build a row layout with gap from a closure.

Source

pub fn build_col_gap( gap: f32, f: impl FnOnce(&mut ContainerCtx<'_>), ) -> Result<Self, PaneError>

Build a column layout with gap from a closure.

Source

pub fn row( kinds: impl IntoIterator<Item = impl Into<Arc<str>>>, ) -> Result<Self, PaneError>

Equal-grow panels in a row, zero gap.

Source

pub fn col( kinds: impl IntoIterator<Item = impl Into<Arc<str>>>, ) -> Result<Self, PaneError>

Equal-grow panels in a column, zero gap.

Source

pub fn row_with( panels: impl IntoIterator<Item = (impl Into<Arc<str>>, Constraints)>, ) -> Result<Self, PaneError>

Panels in a row with explicit constraints per panel.

Source

pub fn col_with( panels: impl IntoIterator<Item = (impl Into<Arc<str>>, Constraints)>, ) -> Result<Self, PaneError>

Panels in a column with explicit constraints per panel.

Source

pub fn presets() -> &'static [PresetInfo]

Return metadata for all built-in presets, sorted alphabetically by name.

Source

pub fn master_stack( kinds: impl IntoIterator<Item = impl Into<Arc<str>>>, ) -> MasterStack

Create a MasterStack builder.

Source

pub fn centered_master( kinds: impl IntoIterator<Item = impl Into<Arc<str>>>, ) -> CenteredMaster

Create a CenteredMaster builder.

Source

pub fn monocle(kinds: impl IntoIterator<Item = impl Into<Arc<str>>>) -> Monocle

Create a Monocle builder.

Source

pub fn scrollable( kinds: impl IntoIterator<Item = impl Into<Arc<str>>>, ) -> Scrollable

Create a Scrollable builder.

Source

pub fn dwindle(kinds: impl IntoIterator<Item = impl Into<Arc<str>>>) -> Dwindle

Create a Dwindle builder.

Source

pub fn spiral(kinds: impl IntoIterator<Item = impl Into<Arc<str>>>) -> Spiral

Create a Spiral builder.

Source

pub fn columns( count: usize, kinds: impl IntoIterator<Item = impl Into<Arc<str>>>, ) -> Columns

Create a Columns builder.

Source

pub fn deck(kinds: impl IntoIterator<Item = impl Into<Arc<str>>>) -> Deck

Create a Deck builder.

Source

pub fn tabbed(kinds: impl IntoIterator<Item = impl Into<Arc<str>>>) -> Tabbed

Create a Tabbed builder.

Source

pub fn stacked(kinds: impl IntoIterator<Item = impl Into<Arc<str>>>) -> Stacked

Create a Stacked builder.

Source

pub fn sidebar( sidebar_kind: impl Into<Arc<str>>, content_kind: impl Into<Arc<str>>, ) -> Sidebar

Create a Sidebar builder.

Source

pub fn holy_grail( header: impl Into<Arc<str>>, footer: impl Into<Arc<str>>, left: impl Into<Arc<str>>, main: impl Into<Arc<str>>, right: impl Into<Arc<str>>, ) -> HolyGrail

Create a HolyGrail builder.

Source

pub fn dashboard( cards: impl IntoIterator<Item = (impl Into<Arc<str>>, usize)>, ) -> Dashboard

Create a Dashboard builder.

Source

pub fn split(first: impl Into<Arc<str>>, second: impl Into<Arc<str>>) -> Split

Create a Split builder.

Source

pub fn grid( cols: usize, kinds: impl IntoIterator<Item = impl Into<Arc<str>>>, ) -> Grid

Create a Grid builder.

Source§

impl Layout

Source

pub fn compile(&self) -> Result<CompileResult, PaneError>

Compile the layout tree into a Taffy tree ready for layout computation.

Trait Implementations§

Source§

impl Debug for Layout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Layout> for LayoutRuntime

Source§

fn from(layout: Layout) -> Self

Converts to this type from the input type.
Source§

impl From<Layout> for LayoutTree

Source§

fn from(layout: Layout) -> Self

Converts to this type from the input type.
Source§

impl TryFrom<CenteredMaster> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: CenteredMaster) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Columns> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Columns) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Dashboard> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Dashboard) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Deck> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Deck) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Dwindle> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Dwindle) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Grid> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Grid) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<HolyGrail> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: HolyGrail) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<MasterStack> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: MasterStack) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Monocle> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Monocle) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Scrollable> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Scrollable) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Sidebar> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Sidebar) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Spiral> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Spiral) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Split> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Split) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Stacked> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Stacked) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Tabbed> for Layout

Source§

type Error = PaneError

The type returned in the event of a conversion error.
Source§

fn try_from(preset: Tabbed) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.