Expand description
workflow-html crate provides HTML templating macros that return
an Html structure containing a collection of DOM elements as well as retained
Rust structures supplied to the template. This ensures the lifetime of Rust
structures for the period Html structure is kept alive. Dropping Html
structure destroys all retained DOM elements as well as Rust structures.
By retaining Rust structures this API ensures that elements and callbacks created by Rust-based HTML elements are retained for the duration of the Html litefime.
In addition, HTML elements marked with @name attributes are collected into
a separate HashMap allowing client to side-access them for external bindings.
This crate works in conjunction with workflow-ux
allowing Rust HTML Form binding to HTML.
Re-exports§
pub use interface::Hooks;pub use interface::Html;pub use escape::escape_attr;pub use escape::escape_html;pub use render::Render;pub use render::Renderables;pub use utils::ElementResult;pub use utils::document;
Modules§
- escape
- HTML and attribute string escaping helpers.
- interface
- The
Htmlcontainer holding rendered roots, hooks and retained renderables. - render
- The
Rendertrait and its implementations for rendering values to DOM/HTML. - utils
- Browser DOM helpers for accessing the
window,documentand elements.
Macros§
- html
- Parses an HTML node tree and expands to an expression that builds the
element tree and renders it via
render_tree(), yielding the resultingHtmlcollection of nodes. - html_
str - Parses an HTML node tree and expands to an expression that builds the
element tree and immediately renders it to an HTML
Stringviahtml(). - tree
- Parses an HTML node tree and expands to the constructed element object tree without rendering it, allowing the resulting structure to be inspected or rendered later.
Structs§
- Element
- A single HTML element node carrying its tag, attributes, optional children and an optional click handler, used to build and render the DOM tree.
- WebElement
- The
Elementclass.
Enums§
- Attribute
Value - The value of an HTML element attribute.
Traits§
- Element
Defaults - Provides default access to the rendered attribute and child markup of an element, used by generated renderable implementations.
- Write
- A trait for writing or formatting into Unicode-accepting buffers or streams.
Type Aliases§
- OnClick
Closure - A retained WASM closure handling a DOM
clickmouse event. - Result
- The type returned by formatter methods.
Attribute Macros§
- renderable
- Attribute macro that turns a named struct into a renderable HTML element.