ferroui_view
module · ferroui-view · v0.5.0
module ferroui_view
ferroui-view
A declarative way to write FerroUI user interfaces in Rust, without XAML:
elements built with chained setters (button().content("Add").on_click(..))
or with the rsx! macro, state held in signals that the properties of
controls follow, and children that follow state.
The pieces (docs/declarative-ui.md has the design):
Element: a description of controls, their property values, handlers and children. It is data, compared by value, so that the reconciler can compare two trees and patch controls; mounting makes the controls (Element::mount).- Builders: a function per control class (
button(),stack_panel()) and a trait per class with a setter per property and a handler per routed event, generated from the sources (scripts/generate_view_builders.py). - Reactivity:
Signal,Memo,effect, owned by anOwner. A setter given a signal or a closure makes the property follow it. - Children that follow state:
for_each(keyed),show,dynamic. - Components that run again:
rerenderand#[component(rerender)], with their state in hooks (use_signal,use_effect, ...); the reconciler compares what they return with what they returned before and patches the controls. - Patterns of larger applications: futures run by a component
(
use_future,suspense,sleep), error boundaries (error_boundary()), and navigation between views (router(),route,use_router). - With the feature
desktop:launchruns an application whose main window is an element.
use ferroui_view::prelude::*;
fn counter() -> Element {
let count = signal(0);
stack_panel()
.spacing(8.0)
.child(text_block().text(move || format!("Count: {}", count.get())))
.child(button().content("Increment").on_click(move |_| count.update(|c| *c += 1)))
.into()
}
Contents
async_data— modulebuilder— modulediagnostics— moduleelement— moduleerror_boundary— modulehooks— modulehot— moduleinspect— modulereactive— modulerouter— modulexaml— modulegenerated— moduleprelude— moduleBind— structBuilder— traitEl— structElementBuilder— traitFromValue— traitIntoProp— traitIntoValue— traitTypedProperty— traitViewClass— traitdynamic— functionfor_each— functionshow— functionshow_else— functionNodeRef— structclear_diagnostics_handler— functionset_diagnostics_handler— functionDiagnostic— enumrerender— functionComponentElement— structElement— enumIntoChild— traitIntoChildren— traitIntoElement— traitKey— enumregister_component— functionComponentHost— structView— type aliasuse_data_context— functionuse_data_context_value— functionuse_effect— functionuse_effect_with— functionuse_hook— functionuse_memo— functionuse_parent_control— functionuse_parent_property— functionuse_resource— functionuse_resource_as— functionuse_signal— functionuse_theme_variant— functionanimation— functionms— functiontransition— functiontransition_eased— functiontransitions— functionuse_animation— functionAnimationBuilder— structKeyFrameBuilder— structTransitionable— traitparse_selector— functionstyle— functionstyle_of— functionStyleBuilder— structinspector— functionmounted_trees— functionInstanceKind— enumInstanceNode— structMountedTree— structPropertyInfo— structview_stats— functionViewStats— structtemplate— functionregister_types— functionASSEMBLY— staticload_xaml— functionload_xaml_uri— functionuse_xaml— functionGridDefinitions— traitsleep— functionsuspense— functionuse_future— functionAsyncState— enumerror_boundary— functionErrorInfo— structroute— functionrouter— functiontry_use_router— functionuse_router— functionRouteDef— structRouteMatch— structRouter— structbatch— functioneffect— functionmemo— functionon_cleanup— functionprovide_context— functionsignal— functionuntrack— functionuse_context— functionMemo— structOwner— structSignal— structTwoWay— structcomponent— usersx— use
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.