pub struct HtmlElement {
pub tag: EcoString,
pub attributes: Vec<HtmlAttribute>,
pub children: Vec<Node>,
pub self_closing: bool,
}Expand description
HTML element
Fields§
§tag: EcoStringHTML tag name
attributes: Vec<HtmlAttribute>HTML attributes
children: Vec<Node>Child nodes
self_closing: boolWhether this is a self-closing element
Implementations§
Source§impl HtmlElement
impl HtmlElement
Sourcepub fn with_attribute(self, name: &str, value: &str) -> Self
pub fn with_attribute(self, name: &str, value: &str) -> Self
Add an attribute to the HTML element
Sourcepub fn with_attributes(self, attrs: Vec<(&str, &str)>) -> Self
pub fn with_attributes(self, attrs: Vec<(&str, &str)>) -> Self
Add multiple attributes to the HTML element
Sourcepub fn with_children(self, children: Vec<Node>) -> Self
pub fn with_children(self, children: Vec<Node>) -> Self
Add child nodes to the HTML element
Sourcepub fn self_closing(self, is_self_closing: bool) -> Self
pub fn self_closing(self, is_self_closing: bool) -> Self
Set whether the element is self-closing
Sourcepub fn tag_matches_any(&self, tags: &[EcoString]) -> bool
pub fn tag_matches_any(&self, tags: &[EcoString]) -> bool
Check if this element’s tag matches any in the provided list (case-insensitive)
Trait Implementations§
Source§impl Clone for HtmlElement
impl Clone for HtmlElement
Source§fn clone(&self) -> HtmlElement
fn clone(&self) -> HtmlElement
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 HtmlElement
impl Debug for HtmlElement
Source§impl PartialEq for HtmlElement
impl PartialEq for HtmlElement
impl StructuralPartialEq for HtmlElement
Auto Trait Implementations§
impl Freeze for HtmlElement
impl !RefUnwindSafe for HtmlElement
impl Send for HtmlElement
impl Sync for HtmlElement
impl Unpin for HtmlElement
impl !UnwindSafe for HtmlElement
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