pub struct LayoutNode {
pub id: String,
pub flex_direction: FlexDirection,
pub size: f32,
pub children: Vec<LayoutNode>,
pub data: Option<LayoutNodeData>,
pub minimized: bool,
pub extra: Map<String, Value>,
}Expand description
One node in the layout tree. Stable UUID-keyed; size is a relative
flex unit; children form the recursive structure (empty for leaves).
JSON shape (matches frontend LayoutNode in frontend/layout/lib/types.ts):
{ "id": "...", "flexDirection": "row", "size": 1, "children": [...], "data": { "blockId": "..." } }Note: Default::size is 0.0 (Rust f32 default), while the serde
deserialization default is 1.0. The Default derive is only for the
..Default::default() spread trick at construction sites — size is
always set explicitly in practice.
Fields§
§id: String§flex_direction: FlexDirection§size: f32Flex size — relative units within the parent’s children array.
Custom serializer emits whole-number sizes as integers (10 not
10.0) to preserve byte-equal compat with prior JSON output.
children: Vec<LayoutNode>§data: Option<LayoutNodeData>§minimized: boolA leaf shown as a header chip (minimize is a display mode: its stored
size is kept, so restore only clears this). Leaf-only.
extra: Map<String, Value>Catch-all for unknown top-level fields. Uses serde_json::Map
(insertion-ordered) for deterministic round-trips.
Trait Implementations§
Source§impl Clone for LayoutNode
impl Clone for LayoutNode
Source§fn clone(&self) -> LayoutNode
fn clone(&self) -> LayoutNode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more