pub struct LayoutNode {
pub id: String,
pub flex_direction: FlexDirection,
pub size: f32,
pub children: Vec<LayoutNode>,
pub data: Option<LayoutNodeData>,
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>§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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LayoutNode
impl Debug for LayoutNode
Source§impl Default for LayoutNode
impl Default for LayoutNode
Source§fn default() -> LayoutNode
fn default() -> LayoutNode
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for LayoutNode
impl<'de> Deserialize<'de> for LayoutNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for LayoutNode
impl PartialEq for LayoutNode
Source§impl Serialize for LayoutNode
impl Serialize for LayoutNode
impl StructuralPartialEq for LayoutNode
Auto Trait Implementations§
impl Freeze for LayoutNode
impl RefUnwindSafe for LayoutNode
impl Send for LayoutNode
impl Sync for LayoutNode
impl Unpin for LayoutNode
impl UnwindSafe for LayoutNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more