fission-core
The runtime, widget system, and action/reducer architecture for the Fission UI framework.
fission-core is the central crate of the Fission toolkit. It provides the declarative widget tree,
the unidirectional data-flow architecture (actions, reducers, effects), and the runtime that
ties everything together. Applications describe their UI as a Node tree built from composable
widgets, dispatch Action values to modify AppState, and let the runtime lower the tree into
the intermediate representation consumed by platform renderers.
Architecture overview
Widget::build() Runtime::dispatch()
| |
View<S> + BuildCtx<S> ActionEnvelope
| |
Node tree Reducer(s)
| |
LoweringContext mutate AppState
| + emit Effects
CoreIR (fission-ir) |
| EffectEnvelope
LayoutEngine |
| Platform executor
Renderer
- Widget layer --
Widget::build()receives read-only state throughView<S>and a mutableBuildCtx<S>for binding actions. It returns aNodetree. - Lowering -- Each
Nodevariant implements theLowertrait, converting itself intofission-iroperations (paint ops, layout ops, semantics). - Layout --
fission-layoutresolves flex, grid, scroll, and absolute positioning. - Rendering -- Platform backends (Metal, Skia, HTML Canvas) consume the laid-out IR.
- Actions -- User interactions produce
ActionEnvelopevalues that theRuntimedispatches to registered reducers. - Reducers -- Pure functions that mutate
AppStateand optionally emit side-effects throughEffects. - Effects -- Asynchronous operations (HTTP, file I/O, alerts) that the platform executor runs outside the deterministic core.
Key concepts
AppState
Any Send + Sync + Debug + 'static type that implements AppState. The runtime stores
one instance per concrete type.
Action / ActionEnvelope
Action is a trait for strongly-typed, serialisable event payloads. Actions are transported
as ActionEnvelope (type-erased ID + JSON bytes) so the reducer pipeline stays generic.
BuildCtx
The mutable context passed to Widget::build(). Use it to:
- Bind actions to handlers:
ctx.bind(MyAction { .. }, my_handler as fn(&mut S, MyAction)) - Register portals (overlays, modals, toasts)
- Request animations
View
Read-only access to AppState, the current theme, i18n registry, layout snapshot, and
animation values.
Node
A serialisable enum with one variant per built-in widget (Button, Text, Row, Column, etc.)
plus a Custom escape hatch.
Effects
Reducers that need async work (network, disk, timers) push EffectEnvelope values through
Effects. The platform executor fulfils them and dispatches the on_ok / on_err callbacks
back into the action pipeline.
Quick example
use *;
use *;
use ;
// 1. Define state
// 2. Define an action
;
// 3. Build the widget tree
;
// 4. Reducer
Crate feature flags
None at this time -- all functionality is included by default.
License
MIT