Module sauron_core::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§

Modules§

  • provides diffing algorithm which returns patches
  • patch module

Structs§

  • These are the plain attributes of an element
  • A generic sized representation of a function that can be attached to a Node. The callback will essentially be owned by the 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.
  • The Attributes partition into 4 different types
  • css styles style can be converted into an attribute
  • Templated view

Enums§

  • Values of an attribute can be in these variants
  • A leaf node value of html dom tree
  • 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
  • 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§

  • 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
  • NOTE: this is specific to sauron framework The replace attribute
  • NOTE: this is specific to sauron framework The skip attribute
  • NOTE: this is specific to sauron framework The skip criteria attribute

Functions§

  • Create an attribute
  • Create an attribute with namespace
  • create a virtual node with tag, attrs and children
  • create a virtual node with namespace, tag, attrs and children
  • create fragment node
  • key attributes is used to match old element and new element when diffing
  • create a leaf node
  • create a node list
  • if the value is true, then this node is made to replace the old node it matches
  • if the value is true, then the diffing of this element and its descendants are skip entirely
  • 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§