Expand description
Intermediate representation for the Fission UI framework.
fission-ir defines the node graph that sits between the high-level widget tree
and the low-level layout and paint pipelines. Every widget compiles down to one or
more CoreNodes stored inside a CoreIR container. Each node carries a single
Op that describes what it does: lay out children, draw something on screen,
group subtrees, or declare accessibility semantics.
§Architecture
Widget Tree --> fission-ir (CoreIR) --> Layout Engine --> Display ListThe IR is platform-agnostic, serializable (via serde), and content-addressed
(every NodeId is a BLAKE3 hash). This makes it cheap to diff across frames
and safe to send across process boundaries.
§Example
use fission_ir::{CoreIR, NodeId, Op, LayoutOp, FlexDirection, FlexWrap, AlignItems, JustifyContent};
let mut ir = CoreIR::new();
let child = NodeId::explicit("label");
ir.add_node(child, Op::Layout(LayoutOp::Box {
width: Some(200.0), height: Some(40.0),
min_width: None, max_width: None,
min_height: None, max_height: None,
padding: [4.0; 4],
flex_grow: 0.0, flex_shrink: 1.0,
aspect_ratio: None,
}), vec![]);
let root = NodeId::explicit("root");
ir.add_node(root, Op::Layout(LayoutOp::Flex {
direction: FlexDirection::Column,
wrap: FlexWrap::NoWrap,
flex_grow: 1.0, flex_shrink: 1.0,
padding: [8.0; 4], gap: Some(4.0),
align_items: AlignItems::Start,
justify_content: JustifyContent::Start,
}), vec![child]);
ir.set_root(root);
assert_eq!(ir.nodes.len(), 2);Re-exports§
pub use node_id::NodeId;pub use op::AlignItems;pub use op::EmbedKind;pub use op::FlexDirection;pub use op::FlexWrap;pub use op::GridPlacement;pub use op::GridTrack;pub use op::JustifyContent;pub use op::LayoutOp;pub use op::Op;pub use op::PaintOp;pub use op::StructuralOp;pub use semantics::ActionEntry;pub use semantics::ActionSet;pub use semantics::Role;pub use semantics::Semantics;pub use widget_id::WidgetNodeId;
Modules§
- node_id
- Content-addressed node identity.
- op
- Operations that IR nodes can perform.
- semantics
- Accessibility and interaction semantics.
- widget_
id - Widget-level identity, separate from IR node identity.
Structs§
- CoreIR
- The root container for an intermediate representation graph.
- Core
Node - A single node in the intermediate representation graph.
Constants§
- IR_
VERSION - The current version of the IR format.