pub enum Mutation {
Show 15 variants
AppendChildren {
id: ElementId,
m: usize,
},
AssignId {
path: &'static [u8],
id: ElementId,
},
CreatePlaceholder {
id: ElementId,
},
CreateTextNode {
value: String,
id: ElementId,
},
LoadTemplate {
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: &'static str,
ns: Option<&'static str>,
value: AttributeValue,
id: ElementId,
},
SetText {
value: String,
id: ElementId,
},
NewEventListener {
name: String,
id: ElementId,
},
RemoveEventListener {
name: String,
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
Add these m children to the target element
Fields
AssignId
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.
Fields
CreatePlaceholder
Create a placeholder in the DOM that we will use later.
Dioxus currently requires the use of placeholders to maintain a re-entrance point for things like list diffing
Fields
CreateTextNode
Create a node specifically for text with the given value
Fields
LoadTemplate
Load and clone an existing node from a template with a given ID
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
Fields
ReplaceWith
Replace the target element (given by its ID) with the topmost m nodes on the stack
Fields
ReplacePlaceholder
Replace an existing element in the template at the given path with the m nodes on the stack
Fields
InsertAfter
Insert a number of nodes after a given node.
Fields
InsertBefore
Insert a number of nodes before a given node.
Fields
SetAttribute
Set the value of a node’s attribute.
Fields
ns: Option<&'static str>
The (optional) namespace of the attribute. For instance, “style” is in the “style” namespace.
value: AttributeValue
The value of the attribute.
SetText
Set the textcontent of a node.
Fields
NewEventListener
Create a new Event Listener.
Fields
RemoveEventListener
Remove an existing Event Listener.
Remove
Remove a particular node from the DOM
PushRoot
Push the given root node onto our stack.