mogwai-html-macro

Crates.iomogwai-html-macro
lib.rsmogwai-html-macro
version0.3.1
sourcesrc
created_at2020-08-09 20:48:11.260864
updated_at2021-12-02 03:54:34.214591
descriptionDeclare mogwai views with RSX
homepage
repository
max_upload_size
id274791
size29,324
Schell Carl Scivally (schell)

documentation

https://docs.rs/mogwai/

README

mogwai-html-macro

Provides procedural macros builder! and view!, which allow the use of RSX to declare mogwai views.

Example - this RSX:

    view!(
        <footer class="info">
            <p>"Double click to edit a todo"</p>
            <p>
                "Written by "
                <a href="https://github.com/schell">"Schell Scivally"</a>
            </p>
            <p>
                "Part of "
                <a href="http://todomvc.com">"TodoMVC"</a>
            </p>
        </footer>
    ).run()

will roughly generate this rust code:

    (mogwai::gizmo::dom::View::element("footer") as View<web_sys::HtmlElement>)
        .attribute("class", "info")
        .with(
            (mogwai::gizmo::dom::View::element("p") as View<web_sys::HtmlElement>)
                .with("Double click to edit a todo"),
        )
        .with(
            (mogwai::gizmo::dom::View::element("p") as View<web_sys::HtmlElement>)
                .with("Written by ")
                .with(
                    (mogwai::gizmo::dom::View::element("a")
                        as View<web_sys::HtmlElement>)
                        .attribute("href", "https://github.com/schell")
                        .with("Schell Scivally"),
                ),
        )
        .with(
            (mogwai::gizmo::dom::View::element("p") as View<web_sys::HtmlElement>)
                .with("Part of ")
                .with(
                    (mogwai::gizmo::dom::View::element("a")
                        as View<web_sys::HtmlElement>)
                        .attribute("href", "http://todomvc.com")
                        .with("TodoMVC"),
                ),
        )
        .run()
Commit count: 0

cargo fmt