dioxus/packages/core/src/mutations.rs

67 lines
1 KiB
Rust
Raw Normal View History

use crate::arena::ElementId;
2021-08-22 21:08:25 +00:00
pub struct Renderer<'a> {
mutations: Vec<Mutation<'a>>,
}
#[derive(Debug)]
pub enum Mutation<'a> {
SetAttribute {
2022-10-22 01:54:14 +00:00
name: &'static str,
value: &'a str,
id: ElementId,
},
LoadTemplate {
name: &'static str,
index: usize,
},
2022-11-02 01:42:29 +00:00
SaveTemplate {
name: &'static str,
m: usize,
},
HydrateText {
path: &'static [u8],
value: &'a str,
id: ElementId,
},
SetText {
value: &'a str,
id: ElementId,
},
ReplacePlaceholder {
2022-11-02 01:42:29 +00:00
m: usize,
2022-11-02 08:00:37 +00:00
path: &'static [u8],
},
AssignId {
path: &'static [u8],
id: ElementId,
},
// Take the current element and replace it with the element with the given id.
Replace {
id: ElementId,
},
2022-11-02 01:42:29 +00:00
CreateElement {
name: &'a str,
namespace: Option<&'a str>,
id: ElementId,
},
CreateText {
value: &'a str,
},
CreatePlaceholder,
AppendChildren {
m: usize,
},
2021-08-22 21:08:25 +00:00
}