Enum dioxus_core::Mutation
source · pub enum Mutation<'a> {
Show 16 variants
AppendChildren {
id: ElementId,
m: usize,
},
AssignId {
path: &'static [u8],
id: ElementId,
},
CreatePlaceholder {
id: ElementId,
},
CreateTextNode {
value: &'a str,
id: ElementId,
},
HydrateText {
path: &'static [u8],
value: &'a str,
id: ElementId,
},
LoadTemplate {
name: &'static str,
index: usize,
id: ElementId,
},
ReplaceWith {
id: ElementId,
m: usize,
},
ReplacePlaceholder {
path: &'static [u8],
m: usize,
},
InsertAfter {
id: ElementId,
m: usize,
},
InsertBefore {
id: ElementId,
m: usize,
},
SetAttribute {
name: &'a str,
value: BorrowedAttributeValue<'a>,
id: ElementId,
ns: Option<&'a str>,
},
SetText {
value: &'a str,
id: ElementId,
},
NewEventListener {
name: &'a str,
id: ElementId,
},
RemoveEventListener {
name: &'a str,
id: ElementId,
},
Remove {
id: ElementId,
},
PushRoot {
id: ElementId,
},
}
Expand description
A Mutation
represents a single instruction for the renderer to use to modify the UI tree to match the state
of the Dioxus VirtualDom.
These edits can be serialized and sent over the network or through any interface
Variants§
AppendChildren
Fields
Add these m children to the target element
AssignId
Fields
Assign the element at the given path the target ElementId.
The path is in the form of a list of indices based on children. Templates cannot have more than 255 children per element, hence the use of a single byte.
CreatePlaceholder
Fields
Create an placeholder int he DOM that we will use later.
Dioxus currently requires the use of placeholders to maintain a re-entrance point for things like list diffing
CreateTextNode
Fields
Create a node specifically for text with the given value
HydrateText
Fields
Hydrate an existing text node at the given path with the given text.
Assign this text node the given ID since we will likely need to modify this text at a later point
LoadTemplate
Fields
Load and clone an existing node from a template saved under that specific name
Dioxus guarantees that the renderer will have already been provided the template. When the template is picked up in the template list, it should be saved under its “name” - here, the name
ReplaceWith
Fields
Replace the target element (given by its ID) with the topmost m nodes on the stack
ReplacePlaceholder
Fields
Replace an existing element in the template at the given path with the m nodes on the stack
InsertAfter
Fields
Insert a number of nodes after a given node.
InsertBefore
Fields
Insert a number of nodes before a given node.
SetAttribute
Fields
value: BorrowedAttributeValue<'a>
The value of the attribute.
Set the value of a node’s attribute.
SetText
Fields
Set the textcontent of a node.
NewEventListener
Fields
Create a new Event Listener.
RemoveEventListener
Remove an existing Event Listener.
Remove
Remove a particular node from the DOM
PushRoot
Push the given root node onto our stack.