Skip to main content

Crate mitsuami_core

Crate mitsuami_core 

Source
Expand description

mitsuami core: the retained node tree, styles and units, layout, accessibility model, control flow and the backend contract.

See docs/ARCHITECTURE.md for the design.

Re-exports§

pub use a11y::A11yAction;
pub use a11y::A11yNode;
pub use a11y::A11yProps;
pub use a11y::ActionError;
pub use a11y::Role;
pub use backend::AvailableSpace;
pub use backend::Backend;
pub use backend::EventSink;
pub use backend::Key;
pub use backend::MeasureRequest;
pub use backend::NativeState;
pub use backend::PlatformMetrics;
pub use backend::SyntheticInput;
pub use backend::TestHooks;
pub use command::Command;
pub use command::EventValue;
pub use command::PointerEvent;
pub use command::PointerKind;
pub use command::UiEvent;
pub use draw::Canvas;
pub use draw::Color;
pub use draw::DisplayList;
pub use draw::Path;
pub use draw::Shape;
pub use geometry::Point;
pub use geometry::Rect;
pub use geometry::Size;
pub use geometry::WindowSize;
pub use style::Align;
pub use style::Display;
pub use style::FlexDirection;
pub use style::GridPlacement;
pub use style::Justify;
pub use style::Style;
pub use style::TextDirection;
pub use style::Track;
pub use style::repeat;
pub use units::Length;
pub use units::LengthExt;
pub use units::Spacing;
pub use mitsuami_reactive as reactive;

Modules§

a11y
Accessibility model. Every node carries semantics from day one. The test driver uses the same roles, names and actions as assistive technology.
backend
The contract every platform backend implements.
command
The data flowing between the core and a backend.
draw
The drawn tier of custom widgets: a small, platform-neutral 2D API.
geometry
services
Platform services: clipboard, dialogs and the menu bar.
style
Layout style: the CSS flexbox / grid property set, in abstract units.
task
Async on the UI thread: a small executor driven by Ui::tick, timers on a swappable clock, and a bridge for work done on other threads.
units
Abstract units, resolved to logical units at layout time.

Macros§

find_prop
Finds a prop by pattern in a prop list.

Structs§

Action
An async operation and its state: action.
AnyValue
Any comparable, printable value: custom widget props and events.
AnyView
A type-erased View.
Callback
A component’s event, Vue’s emit: on_change: Callback<f32> in a #[component] is set with @change=… and fired with on_change.call(v). The default does nothing.
Composed
What a composed render gets: the props (reactive), a way to emit the widget’s events, and the accessible label the app gave the widget.
Custom
A custom widget in the view tree: Custom::<Rating>::new(props), or Rating::view(props) through CustomView.
CustomProps
The props of a custom widget, as carried by Prop::Custom: the value plus the widget’s type-erased definition (semantics and renders).
Element
A node description: kind, style, props (static or reactive), handlers, semantics and children. Widgets wrap an Element and add typed methods.
For
Keyed list rendering. Vue’s v-for with :key.
NodeId
Stable identity of a node for the lifetime of a Ui.
NodeInfo
Snapshot of one native node, for inspection tools and tests.
Opaque
A platform-specific payload the core passes through without looking inside: a native render, a native view factory. Equal only to itself; printed as its label.
Renderer
A widget’s renders on the current platform: native, drawn or composed. The first one present is used: native, then drawn, then composed. The others stay available (for headless tests, .drawn(), .composed()).
Resource
Data loaded asynchronously: resource or resource_on.
Show
Renders then while when is true, otherwise the optional fallback. Vue’s v-if / v-else. Switching branches disposes the old branch’s nodes and reactive state.
Slot
The children a component receives: what goes between its tags. Pass it on as children (Column::new().children(children)); it builds once.
Ui
Handle to a UI instance: one backend, its windows and their node trees. Cheap to clone; all clones share the same state.
WeakUi
Non-owning Ui handle, for closures stored inside the tree itself.

Enums§

ButtonVariant
Semantic button variants, mapped to each platform’s native styles.
Prop
A property of a native widget. Which ones apply depends on the kind.
ScrollAxes
Scrolling directions of a ScrollView.
TextStyle
Semantic text styles, mapped to each platform’s type ramp.
WidgetKind

Traits§

Children
Anything that can be a list of children: a view, a tuple of views, a Vec, an Option, or ().
CustomView
Rating::view(props): shorthand for Custom::<Rating>::new(props).
CustomWidget
The shared, platform-free definition of a custom widget.
Drawn
The drawn tier: measured, drawn and hit-tested in shared code.
ElementBuilder
Style, semantics and test hooks shared by every widget builder.
Render
Which render this platform uses. Implement it once, choosing per platform with platform!:
Store
App-wide state, created once per app by use_store.
View
Something that can build itself into the node tree.

Functions§

action
Wraps run so each dispatch runs it as a task, tracking whether any is pending and keeping the value of the latest one.
provide_stores
Makes use_store work in the current scope and below: the stores live as long as it. App and TestApp call it in their app scope.
resource
Loads fetch() now; again on Resource::refetch.
resource_on
Loads fetch(source()) now, and again whenever the signals source reads change. Vue’s watch plus a fetch; the future’s own reads aren’t tracked.
use_store
The app’s instance of store S, created on first use; or the one provided nearest to this scope, if any.