Skip to main content

AppLayout

Struct AppLayout 

Source
pub struct AppLayout<Node, Message>
where Message: Clone,
{ pub body: Node, pub header: Option<Node>, pub side_bar: Option<Node>, pub footer: Option<Node>, pub header_menu: Option<Node>, pub context_menu: Option<Node>, pub dialog: Option<Dialog<Node, Message>>, pub bottom_sheet: Option<BottomSheet<Node, Message>>, pub toasts: Vec<Toast<Message>>, pub direction: LayoutDirection, pub on_close_menus: Option<Message>, pub on_close_modals: Option<Message>, }
Expand description

The complete declarative description of what should be on screen.

Type parameters:

  • Node — the element type your engine consumes. With the snora engine, this is iced::Element<'a, Message>.
  • Message — your application’s top-level message type.

Fields are intentionally pub so that direct struct literal syntax is available for advanced callers. The new + chainable setters are the canonical path; direct construction is a power-user escape hatch.

Fields§

§body: Node

The main content area. Required.

§header: Option<Node>§side_bar: Option<Node>§footer: Option<Node>§header_menu: Option<Node>

Optional header-attached dropdown (e.g. File menu’s item list). When Some, the engine installs a transparent backdrop that dispatches Self::on_close_menus on any outside click.

§context_menu: Option<Node>

Optional floating context menu (right-click menu). Same backdrop behavior as header_menu.

§dialog: Option<Dialog<Node, Message>>§bottom_sheet: Option<BottomSheet<Node, Message>>§toasts: Vec<Toast<Message>>§direction: LayoutDirection§on_close_menus: Option<Message>

Dispatched when the user clicks outside an open menu (header or context). If None, menus still render but the click-outside-to- close backdrop is not installed — the application must then provide explicit close buttons inside its menu content.

§on_close_modals: Option<Message>

Dispatched when the user clicks the dim backdrop of a dialog or bottom sheet. Semantics mirror Self::on_close_menus.

Implementations§

Source§

impl<Node, Message> AppLayout<Node, Message>
where Message: Clone,

Source

pub fn new(body: Node) -> Self

Start a layout with only a body. All other slots default to their empty / None states.

Source

pub fn header(self, header: Node) -> Self

Source

pub fn side_bar(self, side_bar: Node) -> Self

Source

pub fn footer(self, footer: Node) -> Self

Source

pub fn header_menu(self, menu: Node) -> Self

Source

pub fn context_menu(self, menu: Node) -> Self

Source

pub fn dialog(self, dialog: Dialog<Node, Message>) -> Self

Source

pub fn bottom_sheet(self, sheet: BottomSheet<Node, Message>) -> Self

Source

pub fn toasts(self, toasts: Vec<Toast<Message>>) -> Self

Source

pub fn direction(self, direction: LayoutDirection) -> Self

Source

pub fn on_close_menus(self, msg: Message) -> Self

Source

pub fn on_close_modals(self, msg: Message) -> Self

Auto Trait Implementations§

§

impl<Node, Message> Freeze for AppLayout<Node, Message>
where Node: Freeze, Message: Freeze,

§

impl<Node, Message> RefUnwindSafe for AppLayout<Node, Message>
where Node: RefUnwindSafe, Message: RefUnwindSafe,

§

impl<Node, Message> Send for AppLayout<Node, Message>
where Node: Send, Message: Send,

§

impl<Node, Message> Sync for AppLayout<Node, Message>
where Node: Sync, Message: Sync,

§

impl<Node, Message> Unpin for AppLayout<Node, Message>
where Node: Unpin, Message: Unpin,

§

impl<Node, Message> UnsafeUnpin for AppLayout<Node, Message>
where Node: UnsafeUnpin, Message: UnsafeUnpin,

§

impl<Node, Message> UnwindSafe for AppLayout<Node, Message>
where Node: UnwindSafe, Message: UnwindSafe,

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.