euv_core/renderer/struct.rs
1use crate::*;
2
3/// Manages the rendering of virtual DOM nodes to the real DOM.
4///
5/// Maintains a mapping between virtual nodes and real DOM elements,
6/// and handles creation, diffing, and patching of the DOM tree.
7#[derive(Data, New)]
8pub struct Renderer {
9 /// Mapping from virtual node IDs to real DOM elements.
10 #[get(pub(crate))]
11 #[set(pub(crate))]
12 #[new(skip)]
13 node_map: HashMap<usize, Element>,
14 /// The root DOM element.
15 #[get(pub(crate))]
16 #[set(pub(crate))]
17 root: Element,
18 /// The current virtual DOM tree.
19 #[get(pub(crate))]
20 #[set(pub(crate))]
21 #[new(skip)]
22 current_tree: Option<VirtualNode>,
23 /// Counter for generating unique node IDs.
24 #[get(pub(crate))]
25 #[set(pub(crate))]
26 #[new(skip)]
27 next_id: Rc<RefCell<usize>>,
28}