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§
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. - Grouped
Attribute Values - The Attributes partition into 4 different types
- Style
- css styles style can be converted into an attribute
- Templated
View - Templated view
Enums§
- Attribute
Value - 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§
- Attribute
Name - The type of Attribute Name
- Component
Event Callback - Mount callback is used for mounting the component into the DOM This requires no MSG to be emitted
- Event
Callback - Callback where Event type is supplied for Components
- Namespace
- The type of the Namspace
- Tag
- The type of the Tag