Trait Htmlify

Source
pub trait Htmlify {
    // Provided methods
    fn tag(&self) -> Cow<'static, str> { ... }
    fn attributes(&self) -> Vec<Attribute> { ... }
    fn inner_html(&self) -> Vec<Box<dyn Htmlify>> { ... }
    fn inner_html_as_string(&self) -> String { ... }
    fn as_raw_html(&self) -> String { ... }
    fn as_element(&self) -> Option<Element> { ... }
    fn as_yew_node(&self) -> Html { ... }
}
Expand description

Trait used to generate HTML from Rust structures. See module-level documentation for more details.

Provided Methods§

Source

fn tag(&self) -> Cow<'static, str>

Sets the HTML tag associated when converting this to an element.

Source

fn attributes(&self) -> Vec<Attribute>

Sets the attributes to include when converting this to an element.

Source

fn inner_html(&self) -> Vec<Box<dyn Htmlify>>

Get the inner HTML

Source

fn inner_html_as_string(&self) -> String

Stringifies the inner HTML

Source

fn as_raw_html(&self) -> String

Convert this to a raw string of HTML

Source

fn as_element(&self) -> Option<Element>

Convert this into a web_sys::Element

Source

fn as_yew_node(&self) -> Html

Convert this into ::yew::Html

Implementations on Foreign Types§

Source§

impl Htmlify for &str

Raw strings are a special case of Htmlify

Source§

fn tag(&self) -> Cow<'static, str>

Used as a sentinal value

Source§

fn as_raw_html(&self) -> String

Strings are nothing but raw HTML

Source§

fn as_element(&self) -> Option<Element>

Raw strings are not elements, return None.

Implementors§