Crate virtual_dom_rs

source ·
Expand description

virtual-dom-rs provides a virtual dom implementation as well as an html! macro that you can use to generate a virtual dom.

The virtual dom works on both the client and server. On the client we’ll render to an HtmlElement, and on the server we render to a String.

Re-exports

pub extern crate web_sys;
pub use crate::html_macro::*;
pub use crate::virtual_node::*;

Modules

The html_macro module exposes an html! macro that is used to generate VirtualNode’s that will eventually get rendered into DOM nodes on the client side, or String’s if you’re on the server side.
Exports structs and macros that you’ll almost always want access to in a virtual-dom powered application
The virtual_node module exposes the VirtualNode struct and methods that power our virtual dom.

Macros

A macro which returns a root VirtualNode given some HTML and Rust expressions.

Structs

The CharacterData class.
A handle to both a closure in Rust as well as JS closure which will invoke the Rust closure.
The Comment class.
The Document class.
The DomTokenList class.
The Element class.
The Event class.
The EventTarget class.
The HtmlCollection class.
The HtmlElement class.
The MessageEvent class.
The Node class.
The NodeList class.
The Text class.
The Window class.
The Worker class.

Enums

A Patch encodes an operation that modifies a real DOM element.

Traits

A trait with common functionality for rendering front-end views.

Functions

Given two VirtualNode’s generate Patch’s that would turn the old virtual node’s real DOM node equivalent into the new VirtualNode’s real DOM node equivalent.
Apply all of the patches to our old root node in order to create the new root node that we desire. This is usually used after diffing two virtual nodes.
Getter for the Window object