Expand description
Layer 1+2 of Frust: the declarative view API, the retained widget tree, box-constraint layout, and the rebuild/layout/paint pass skeleton.
The design mirrors xilem_core’s proven View lifecycle and Masonry’s
tree_arena-backed widget tree, but owns its implementation — there is no
xilem/masonry dependency and no unsafe in this crate.
§Layers
view— layer 1: theViewtrait,ChangeFlags, andBuildCtx. Views are cheap descriptors produced byfn build(&mut State) -> impl View<State>.widget— layer 2: theWidgettrait and its layout/paint/event contexts, thePaintScenepaint boundary, and container-ownedChildPodchildren.event— layer 2 input:InputEvent/PointerEventand theEventCtxhandlers mutate state through.input— pure gesture helpers: slop/wheel constants, aVelocityTracker, and the fling-decay math the interactive widgets build on.layout— theBoxConstraintsbox model.tree— theWidgetTreearena wrapper,WidgetPod, and the read-onlyInspectNodewalk tooling reads the tree through.app— theRenderRootthat drives rebuild → layout → paint. This is what each platform shell owns.- [
component] —Component, Flutter’sStatefulWidgetanalog: a subtree with retained local state, a per-component reactiveOwner, and a state boundary the outer view tree never sees. overlay— the overlay portal: an owner-hosted, root-painted, root-routed pod a widget floats above the whole app (menus, popovers, tooltips, selection toolbars).selection_toolbar— what a text field publishes when it has a selection, plus the process-global policy/builder slots that decide who draws the toolbar.hit— hit-testing helpers for content drawn under an arbitrarykurbo::Affine: the testChildPoduses for a transformed pod, exposed for canvas hit closures and pan/zoom containers.
Re-exports§
pub use anim::AnimationController;pub use anim::AnimationStatus;pub use anim::Curve;pub use anim::FrameTime;pub use anim::Lerp;pub use anim::Spring;pub use anim::SpringDesc;pub use anim::Tween;pub use app::Orientation;pub use app::RenderRoot;pub use app::WindowMetrics;pub use component::Component;pub use component::ComponentView;pub use component::ComponentWidget;pub use component::component;pub use event::CursorIcon;pub use event::EditCommand;pub use event::EditingState;pub use event::EventCtx;pub use event::EventOutcome;pub use event::EventResult;pub use event::ImeContentType;pub use event::ImeEvent;pub use event::ImeState;pub use event::InputEvent;pub use event::Key;pub use event::KeyEvent;pub use event::Modifiers;pub use event::NamedKey;pub use event::OverlayEvent;pub use event::OverlayEventKind;pub use event::PointerButton;pub use event::PointerEvent;pub use event::PointerPhase;pub use event::ScrollDelta;pub use event::has_pending_result_flush;pub use event::mark_focus_orphaned;pub use event::mark_pending_result_flush;pub use event::take_focus_orphaned;pub use event::take_pending_result_flush;pub use input::FLING_DECAY;pub use input::FLING_STOP;pub use input::MOUSE_SLOP;pub use input::TOUCH_SLOP;pub use input::VELOCITY_WINDOW_MS;pub use input::VelocityTracker;pub use input::WHEEL_LINE_PX;pub use input::fling_decay;pub use input::fling_displacement;pub use insets::CornerInset;pub use insets::CornerInsets;pub use insets::EdgeInsets as WindowEdgeInsets;pub use insets::WindowInsets;pub use layout::BoxConstraints;pub use overlay::OutsideTap;pub use overlay::OverlayBand;pub use overlay::OverlayEntry;pub use overlay::OverlayHit;pub use overlay::OverlayInput;pub use overlay::OverlayKey;pub use overlay::OverlayPod;pub use selection_toolbar::SelectionToolbarActions;pub use selection_toolbar::SelectionToolbarBuilder;pub use selection_toolbar::SelectionToolbarPolicy;pub use selection_toolbar::SelectionToolbarRequest;pub use selection_toolbar::install_selection_toolbar_builder_if_unset;pub use selection_toolbar::lock_selection_toolbar_policy;pub use selection_toolbar::selection_toolbar_builder;pub use selection_toolbar::selection_toolbar_policy;pub use selection_toolbar::set_selection_toolbar_builder;pub use selection_toolbar::set_selection_toolbar_policy;pub use semantics::SemanticsCtx;pub use semantics::SemanticsUpdate;pub use tree::InspectNode;pub use tree::WidgetPod;pub use tree::WidgetTree;pub use view::AnyView;pub use view::BuildCtx;pub use view::ChangeFlags;pub use view::View;pub use view::WidgetId;pub use view::any;pub use widget::ChildPod;pub use widget::DiscardScene;pub use widget::HeroDirective;pub use widget::HeroFrames;pub use widget::LayoutCtx;pub use widget::PaintCtx;pub use widget::PaintOutcome;pub use widget::PaintScene;pub use widget::TickClass;pub use widget::Widget;pub use accesskit;
Modules§
- anim
- Animation vocabulary: the shared frame clock (
FrameTime) plus the pure math widgets consume it through — easingCurves,Tweeninterpolation, analyticSpringdynamics, and the duration-/spring-drivenAnimationController. - app
- The render root: the object each platform shell drives each frame.
- component
- Component: Flutter’s
StatefulWidgetanalog. - event
- Layer 2 input: pointer/scroll events and the
EventCtxa widget mutates while handling them. - hit
- Hit-testing under an arbitrary
kurbo::Affine. - input
- Pure input/gesture helpers: slop/wheel constants, a trailing-window
VelocityTracker, and the fling-decay math (numbers cross-checked against masonry’s implementation). - insets
- Window insets: Flutter’s
ViewportMetricsinset model ported into the framework core. - layout
- Box-constraint layout model.
- overlay
- The overlay portal: the mechanism a widget anywhere in the tree floats a pod above the whole app with.
- selection_
toolbar - The selection-toolbar seam: what a text field asks for when it has a selection, and who draws it.
- semantics
- Layer 2: the semantics seam — a pull-based accessibility tree pass.
- tree
- The retained widget tree, backed by
tree_arena. - view
- Layer 1: the declarative
Viewtrait. - widget
- Layer 2: the retained
Widgettrait and its layout/paint contexts.
Structs§
- Corner
Radii - The per-corner radii and dash-pattern vocabulary
PaintScene’s own signatures name, re-exported fromfrust-sceneso a widget callingPaintScene::fill_rounded_rect_radii/PaintScene::push_clip_rounded_radii/PaintScene::stroke_path_dashedcan name their arguments through the same paint surface it already paints through (mirrors the crate-rootaccesskitre-export). Per-corner radii for a rounded rectangle, in the pre-transform coordinate space. - Dash
Pattern - The per-corner radii and dash-pattern vocabulary
PaintScene’s own signatures name, re-exported fromfrust-sceneso a widget callingPaintScene::fill_rounded_rect_radii/PaintScene::push_clip_rounded_radii/PaintScene::stroke_path_dashedcan name their arguments through the same paint surface it already paints through (mirrors the crate-rootaccesskitre-export). A stroke’s dash pattern: anonrun, anoffgap, and aphaseoffset into that repeating cycle — all lengths in the pre-transform coordinate space.