Crate percy_vdom[][src]

Expand description

percy-vdom 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.


pub extern crate web_sys;


Exports structs and macros that you’ll almost always want access to in a virtual-dom powered application

A collection of functions that are useful for unit testing your html! views.


Used to generate VirtualNode’s from a TokenStream.


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.

A node along with all of the closures that were created for that node’s events and all of it’s child node’s events.

The Document class.

The DomTokenList class.

Used for keeping a real DOM node up to date based on the current VirtualNode and a new incoming VirtualNode that represents our latest DOM state.

The Element class.

The Event class.

The EventTarget class.

We need a custom implementation of fmt::Debug since JsValue doesn’t implement debug.

The HtmlCollection class.

The HtmlElement class.

The HtmlInputElement class.

The InputEvent class.

Used by the html! macro for all braced child nodes so that we can use any type that implements Into

The MessageEvent class.

The MouseEvent class.

The Node class.

The NodeList class.

The Text class.

The UiEvent class.

The Window class.

The Worker class.


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

When building your views you’ll typically use the html! macro to generate VirtualNode’s.


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


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

Type Definitions

Box<dyn AsRef>> is our js_sys::Closure. Stored this way to allow us to store any Closure regardless of the arguments.