Skip to main content

Crate workflow_html

Crate workflow_html 

Source
Expand description

github crates.io docs.rs license

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 Html container holding rendered roots, hooks and retained renderables.
render
The Render trait and its implementations for rendering values to DOM/HTML.
utils
Browser DOM helpers for accessing the window, document and 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 resulting Html collection 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 String via html().
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 Element class.

Enums§

AttributeValue
The value of an HTML element attribute.

Traits§

ElementDefaults
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§

OnClickClosure
A retained WASM closure handling a DOM click mouse event.
Result
The type returned by formatter methods.

Attribute Macros§

renderable
Attribute macro that turns a named struct into a renderable HTML element.