[][src]Crate mt_dom

mt-dom is a generic virtual dom implementation which doesn't specify the types of the data that is being processed. It's up to the library user to specify those types

The goal of this library is to provide virtual dom diffing functionality and return a portable patches which the user can then use to apply those patches in their respective UI elements.

mt-dom is not limited to be used in html base virtual-dom implementation, but can also be use for native UI elements.

Re-exports

pub use apply_patches::apply_patches;
pub use diff::diff_with_key;
pub use patch::NodeIdx;
pub use patch::Patch;

Modules

apply_patches

apply patches for verifying the patches are correct when current_dom will be equal to the target_dom when patches is applied.

diff

provides diffing algorithm which returns patches

patch

patch module

Structs

Attribute

These are the plain attributes of an element

Callback

A generic sized representation of a function that can be attached to a Node. The callback will essentially be owned by the element

Element

Represents an element of the virtual node An element has a generic tag, this tag could be a static str tag, such as usage in html dom. Example of which are div, a, input, img, etc.

Enums

AttValue

Attribute Value which can be a plain attribute or a callback

Node

represents a node in a virtual dom A node could be an element which can contain one or more children of nodes. A node could also be just a text node which contains a string

Functions

attr

Create an attribute

attr_ns

Create an attribute with namespace

element

create a virtual node with tag, attrs and children

element_ns

create a virtual node with namespace, tag, attrs and children

group_attributes_per_name

group attributes of the same name

merge_attributes_of_same_name

merge the values of attributes with the same name

on

create an attribute from callback

text

Create a textnode element