Expand description
§snora
The iced engine for the Snora GUI framework.
This crate binds snora_core vocabulary to iced. It exposes a single
entry point, [render], a toast lifecycle helper module, and — when
the widgets feature is enabled (the default) — a re-exported set of
prefab iced::Element builders from the snora-widgets crate.
§Layering
Your application
│
▼
snora::render(AppLayout<Element, Message>) -> Element
│
├─► snora-widgets (optional, prefab UI parts)
▼
snora-core (vocabulary: Toast, Dialog, Sheet, SheetSize, …)The dependency graph above is strict and the only way crates relate to each other:
snora-corehas zero iced dependency. It owns the vocabulary (what choices exist).snora-widgetsdepends onsnora-coreandiced. It owns the prefab widget visuals.snoradepends onsnora-coreand (optionally)snora-widgets. It owns the engine —render, the layer composition, and the toast lifecycle helpers.
Applications normally only depend on snora and use it as the single
umbrella crate; the workspace split exists so each layer can evolve
at its own pace.
§A minimal application view
ⓘ
use iced::{Element, widget::text};
use snora::{AppLayout, render, LayoutDirection};
fn view(state: &MyState) -> Element<'_, Message> {
let body: Element<'_, Message> = text("Hello, snora!").into();
let layout = AppLayout::new(body)
.direction(LayoutDirection::Ltr);
render(layout)
}§Engine-only builds
Applications that supply 100 % of their UI parts and do not want the prefab widgets compiled in can opt out:
[dependencies]
snora = { version = "0.6", default-features = false }In this configuration snora-widgets is not pulled in and the
snora::widget module does not exist.
Re-exports§
pub use render::render;
Modules§
- direction
widgets - Direction-aware row helpers. Re-exported from
snora-widgets. Direction-aware layout helpers. - render
- The single rendering entry point: [
render]. The engine: turn anAppLayoutinto aniced::Element. - style
widgets - Shared style functions used by the prefab widgets.
Re-exported from
snora-widgets. Shared styling for snora’s built-in widgets. - toast
- Toast rendering and lifecycle helpers
(
subscription,sweep_expired). Toast rendering and lifecycle utilities. - widget
widgets - Optional prefab
iced::Elementbuilders for header / sidebar / footer / menu / icon. Re-exported fromsnora-widgets.
Structs§
- AppLayout
- The complete declarative description of what should be on screen.
- Crumb
- One step in a breadcrumb trail.
- Dialog
- A modal dialog.
- Menu
- A top-level menu in the header (e.g. “File”, “View”).
- Menu
Item - A single entry in a menu’s dropdown.
- Sheet
- A panel that slides in from one of the window edges.
- SideBar
- The vertical navigation rail as a whole.
- Side
BarItem - One entry in a sidebar.
- Tab
- One tab in a
TabBar. Carries an application-definedTabIdso that the application is the source of truth for which tab is which. - TabBar
- A horizontal tab strip.
- Toast
- A toast notification.
Enums§
- Breadcrumb
Action - What happens when the user interacts with the breadcrumb trail.
- Edge
- A logical position along a primary axis.
- Icon
- An icon, with feature-gated source variants.
- Layout
Direction - Reading direction of the application’s layout.
- Menu
Action - An event emitted by a header menu.
- Sheet
Edge - Which window edge a sheet attaches to.
- Sheet
Size - The size a sheet should occupy along the axis perpendicular to its anchor edge.
- TabAction
- What happens when the user interacts with a tab.
- Toast
Intent - Semantic intent of a notification.
- Toast
Lifetime - Auto-dismiss policy for a toast.
- Toast
Position - Where the toast stack anchors within the window.