Module vdom

Source
Expand description

vdom stands for virtual-dom. This module contains types that are derived from mt-dom where we assign concrete types into the generics.

All the code in this module are run in purely rust environment, that is there is NO code here involves accessing the real DOM.

Re-exports§

pub use diff::diff;
pub use diff::diff_recursive;
pub use patch::Patch;
pub use patch::PatchType;
pub use patch::TreePath;

Modules§

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.
GroupedAttributeValues
The Attributes partition into 4 different types
Style
css styles style can be converted into an attribute
TemplatedView
Templated view

Enums§

AttributeValue
Values of an attribute can be in these variants
Leaf
A leaf node value of html dom tree
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
Value
Wraps different primitive variants used as values in html This is needed since html attributes can have different value types such as checked(bool), name(String), tab_index(i32) Note: memory size of Value is 32 bytes, in comparison String is 24 bytes

Statics§

KEY
Special Node attributes that are treated differently such as key and skip which both greatly affects the diffing algorithm NOTE: this is specific to sauron framework The key attribute
REPLACE
NOTE: this is specific to sauron framework The replace attribute
SKIP
NOTE: this is specific to sauron framework The skip attribute
SKIP_CRITERIA
NOTE: this is specific to sauron framework The skip criteria attribute

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
fragment
create fragment node
key
key attributes is used to match old element and new element when diffing
leaf
create a leaf node
node_list
create a node list
replace
if the value is true, then this node is made to replace the old node it matches
skip
if the value is true, then the diffing of this element and its descendants are skip entirely
skip_criteria
if the value of this attribute of the old element and the new element is the same the diffing of this element and its descentdants are skip entirely

Type Aliases§

AttributeName
The type of Attribute Name
ComponentEventCallback
Mount callback is used for mounting the component into the DOM This requires no MSG to be emitted
EventCallback
Callback where Event type is supplied for Components
Namespace
The type of the Namspace
Tag
The type of the Tag