Documentation
  • Coverage
  • 0%
    0 out of 4 items documented0 out of 0 items with examples
  • Size
  • Source code size: 43.83 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 7.65 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2m 5s Average build duration of successful builds.
  • all releases: 2m 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MNThomson

htmlrs

Usage

cargo add htmlrs

Take a look at the examples folder!

use htmlrs::{component, html, view, Children, IntoView};

#[component]
fn Text(text: String) -> impl IntoView {
    view! {<span>{text}</span>}
}

#[component]
fn TextInto(#[prop(into)] text: String) -> impl IntoView {
    view! {<span>{text}</span>}
}

#[component]
fn Page(children: Children) -> impl IntoView {
    view! {<div>{children()}</div>}
}

fn main() {
    let page = html! {
        <Page>
            <Text text="hello".to_string() />
            <TextInto text="world" />
        </Page>
    };
    println!("{}", page);
    assert_eq!(page, "<div><span>hello</span><span>world</span></div>")
}