pub struct HtmlElement { /* private fields */ }
Expand description
Represents an html tag such as <div>
, <span>
, etc.
Implementations§
Source§impl HtmlElement
impl HtmlElement
Sourcepub fn new() -> HtmlElementBuilder<()>
pub fn new() -> HtmlElementBuilder<()>
Build a new HtmlElement
HtmlElement::new().tag_name("div").build();
pub fn tag_name(&self) -> &str
Sourcepub fn attributes(&self) -> &HashMap<String, String>
pub fn attributes(&self) -> &HashMap<String, String>
get a map of all the attributes:
For a <div id="foo" class="bar">
this would return
{"id": "foo", "class": "bar"}
Sourcepub fn callbacks(&self) -> &HashMap<String, EventHandler>
pub fn callbacks(&self) -> &HashMap<String, EventHandler>
get a map of all the callbacks / event handlers:
For a <div on_click=|_| { alert!("clicked")}>
this would return
{ "click": |event| { alert!("clicked") } }
Trait Implementations§
Source§impl Debug for HtmlElement
impl Debug for HtmlElement
Source§impl<E> From<HtmlElement> for Element<HtmlNode, E>
impl<E> From<HtmlElement> for Element<HtmlNode, E>
Source§fn from(element: HtmlElement) -> Self
fn from(element: HtmlElement) -> Self
Converts to this type from the input type.
Source§impl From<HtmlElement> for HtmlNode
impl From<HtmlElement> for HtmlNode
Source§fn from(element: HtmlElement) -> Self
fn from(element: HtmlElement) -> Self
Converts to this type from the input type.
Source§impl PartialEq for HtmlElement
impl PartialEq 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