Skip to main content

Module view

Module view 

Source
Expand description

Layer 1: the declarative View trait.

Views are cheap, short-lived descriptors produced by a root component’s Component::build closure, a pure function of application state (fn build(&mut State) -> impl View<State>). They are not the retained tree — re-running the build closure on every state mutation must stay cheap by construction.

The lifecycle mirrors xilem_core’s proven View design (build/rebuild/teardown/message) but owns its implementation: no xilem/masonry dependency. The Action generic is intentionally omitted for v0 — messages route directly against State.

Structs§

AnyView
A type-erased View: lets a piece of UI change its concrete view type between frames (e.g. a conditional if cond { text(..) } else { button(..) }) while still fitting the statically-typed rebuild machinery.
BuildCtx
Context threaded through View::build / View::rebuild.
ChangeFlags
Bitflags describing what work a View::rebuild pass invalidated.
WidgetId
A stable identity for a node in the widget tree.

Traits§

View
A declarative description of a piece of UI.

Functions§

any
Erase view into an AnyView — the free-function spelling of AnyView::new, mirroring the text(..)/button(..) view-fn vocabulary.