Skip to content

struct

Element

pub struct Element {
    pub name: String,
    pub attrs: Vec<Attr>,
    pub events: Vec<EventBinding>,
    pub children: Vec<Node>,
}

An element (or component, when the name is capitalised).

Fields

name

pub name: String

The element or component name.

attrs

pub attrs: Vec<Attr>

Its attributes, in the order written.

events

pub events: Vec<EventBinding>

Its event bindings, in the order written.

children

pub children: Vec<Node>

Its children: the nodes inside its braces, or its text.

Methods

new

pub fn new(name: &str) -> Element

An element called name, with no attributes, events or children.

is_component

pub fn is_component(&self) -> bool

Capitalised names refer to user components rather than built-ins.

attr

pub fn attr(&self, name: &str) -> Option<&Value>

The value of attribute name, if it's set.

Trait implementations