pub struct TreeNode {
pub id: String,
pub type_name: String,
pub props: Props,
pub children: Vec<TreeNode>,
}Expand description
A single node in the UI tree.
Each node has a unique id (scoped to the tree, assigned by the host),
a type_name that determines which widget renders it, a props map
of widget-specific properties, and optional children for container
widgets.
Fields§
§id: StringUnique identifier for this node within the tree.
type_name: StringWidget type name (e.g. "button", "text", "slider").
props: PropsWidget-specific properties.
children: Vec<TreeNode>Child nodes for container widgets.
Implementations§
Source§impl TreeNode
impl TreeNode
Sourcepub fn canonical_hash(&self) -> Result<String, Error>
pub fn canonical_hash(&self) -> Result<String, Error>
Compute the canonical tree hash used across SDKs.
The hash input is recursively key-sorted JSON, so semantically identical trees hash the same regardless of object insertion order.
§Errors
Returns a serialization error if the tree cannot be converted to JSON.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TreeNode
impl<'de> Deserialize<'de> for TreeNode
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
impl StructuralPartialEq for TreeNode
Auto Trait Implementations§
impl Freeze for TreeNode
impl RefUnwindSafe for TreeNode
impl Send for TreeNode
impl Sync for TreeNode
impl Unpin for TreeNode
impl UnsafeUnpin for TreeNode
impl UnwindSafe for TreeNode
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