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<LayoutNode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LayoutNode, <__D as Deserializer<'de>>::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
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.