pub struct Element {
pub kind: ElementKind,
pub props: Props,
pub children: Vec<Element>,
pub key: Option<String>,
}Expand description
A renderable element in the algebraic element tree.
Unlike virtual DOM nodes, Elements are nodes in a geometric dataflow graph. They represent projections from geometric state to DOM operations.
Fields§
§kind: ElementKindThe kind of element (tag, text, component reference)
props: PropsProps/attributes for this element
children: Vec<Element>Child elements
key: Option<String>Unique key for reconciliation (optional)
Implementations§
Source§impl Element
impl Element
Sourcepub fn new(kind: ElementKind) -> Self
pub fn new(kind: ElementKind) -> Self
Create a new element with the given kind.
Sourcepub fn fragment(children: Vec<Element>) -> Self
pub fn fragment(children: Vec<Element>) -> Self
Create a fragment (multiple elements without a wrapper).
Sourcepub fn children(self, children: impl IntoIterator<Item = Element>) -> Self
pub fn children(self, children: impl IntoIterator<Item = Element>) -> Self
Add multiple children.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Count total nodes in this element tree.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Element
impl !RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnsafeUnpin for Element
impl !UnwindSafe for Element
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