//! Platform-agnostic node tree. //! //! `PlatformNode` is the universal representation of a UI element. //! Each backend converts this to its native equivalent. /// An attribute on a platform node. #[derive(Debug, Clone, PartialEq, Eq)] pub struct Attribute { pub name: String, pub value: String, } impl Attribute { pub fn new(name: impl Into, value: impl Into) -> Self { Self { name: name.into(), value: value.into() } } } /// A boxed event handler function. /// Using `Box` so platform nodes can store handlers without /// knowing the native event type. pub type EventHandler = Box; /// The kind of a platform node. #[derive(Debug, Clone, PartialEq, Eq)] pub enum PlatformNodeKind { /// An element node: `
`, `