Skip to main content

AppShell

Struct AppShell 

Source
pub struct AppShell<'a, Msg> { /* private fields */ }
Expand description

Builds the common application frame: a header on top, a sidebar on the left, the body beside it and a footer at the bottom.

The parts are separated by surface colour only. Below collapse_below columns the sidebar is hidden to give the body room; while sidebar_open is true it is drawn over the body as a layer instead. Style keys: shell-header, shell-sidebar, shell-body, shell-footer (bg).

Implementations§

Source§

impl<'a, Msg: 'static> AppShell<'a, Msg>

Source

pub fn new() -> Self

A shell with a 28-column sidebar that collapses below 90 columns.

Source

pub fn header(self, build: impl FnOnce(&mut View<'_, Msg>) + 'a) -> Self

The top bar.

Source

pub fn sidebar(self, build: impl FnOnce(&mut View<'_, Msg>) + 'a) -> Self

The navigation column.

Source

pub fn body(self, build: impl FnOnce(&mut View<'_, Msg>) + 'a) -> Self

The main content.

Source

pub fn footer(self, build: impl FnOnce(&mut View<'_, Msg>) + 'a) -> Self

The bottom bar, usually KeyHints.

Source

pub fn sidebar_width(self, columns: u16) -> Self

Sidebar width in columns.

Source

pub fn collapse_below(self, columns: u16) -> Self

Screen width under which the sidebar collapses.

Source

pub fn sidebar_open(self, open: bool) -> Self

Shows the collapsed sidebar as a layer over the body.

Source

pub fn show<'v>(self, ui: &'v mut View<'_, Msg>) -> NodeMut<'v, Msg>

Adds the shell to ui, filling the space it gets.

Trait Implementations§

Source§

impl<Msg: 'static> Default for AppShell<'_, Msg>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a, Msg> !RefUnwindSafe for AppShell<'a, Msg>

§

impl<'a, Msg> !Send for AppShell<'a, Msg>

§

impl<'a, Msg> !Sync for AppShell<'a, Msg>

§

impl<'a, Msg> !UnwindSafe for AppShell<'a, Msg>

§

impl<'a, Msg> Freeze for AppShell<'a, Msg>
where Option<Box<dyn FnOnce(&mut View<'_, Msg>) + 'a>>: Freeze,

§

impl<'a, Msg> Unpin for AppShell<'a, Msg>
where Option<Box<dyn FnOnce(&mut View<'_, Msg>) + 'a>>: Unpin,

§

impl<'a, Msg> UnsafeUnpin for AppShell<'a, Msg>
where Option<Box<dyn FnOnce(&mut View<'_, Msg>) + 'a>>: UnsafeUnpin,

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.