pub struct SurfaceNode {
pub component_type: String,
pub props: BTreeMap<String, PropValue>,
pub children: Vec<SurfaceNode>,
}Expand description
A single node in the abstract UI tree.
Matches the JSON schema from host-integration.md:
{
"type": "Column",
"props": { "spacing": 8 },
"children": [ ... ]
}Props use BTreeMap for deterministic serialization order.
Fields§
§component_type: StringComponent type name (e.g., “Column”, “Text”, “Button”).
props: BTreeMap<String, PropValue>Component properties. Uses BTreeMap for deterministic key ordering.
children: Vec<SurfaceNode>Child nodes (empty for leaf components like Text, Button).
Implementations§
Source§impl SurfaceNode
impl SurfaceNode
Sourcepub fn new(component_type: impl Into<String>) -> Self
pub fn new(component_type: impl Into<String>) -> Self
Create a new node with the given component type and no props or children.
Sourcepub fn with_child(self, child: SurfaceNode) -> Self
pub fn with_child(self, child: SurfaceNode) -> Self
Builder: add a child node.
Sourcepub fn with_children(self, children: Vec<SurfaceNode>) -> Self
pub fn with_children(self, children: Vec<SurfaceNode>) -> Self
Builder: set children.
Sourcepub fn add_child(&mut self, child: SurfaceNode)
pub fn add_child(&mut self, child: SurfaceNode)
Add a child (mutable).
Trait Implementations§
Source§impl Clone for SurfaceNode
impl Clone for SurfaceNode
Source§fn clone(&self) -> SurfaceNode
fn clone(&self) -> SurfaceNode
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 SurfaceNode
impl Debug for SurfaceNode
Source§impl<'de> Deserialize<'de> for SurfaceNode
impl<'de> Deserialize<'de> for SurfaceNode
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 SurfaceNode
impl PartialEq for SurfaceNode
Source§impl Serialize for SurfaceNode
impl Serialize for SurfaceNode
impl StructuralPartialEq for SurfaceNode
Auto Trait Implementations§
impl Freeze for SurfaceNode
impl RefUnwindSafe for SurfaceNode
impl Send for SurfaceNode
impl Sync for SurfaceNode
impl Unpin for SurfaceNode
impl UnwindSafe for SurfaceNode
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