sauron_core/dom/program/
mount_procedure.rs1#[derive(Clone, Copy)]
3pub enum MountAction {
4 Append,
6 ClearAppend,
8 Replace,
10}
11
12#[derive(Clone, Copy)]
14pub enum MountTarget {
15 MountNode,
17 ShadowRoot,
19}
20
21#[derive(Clone, Copy)]
23pub struct MountProcedure {
24 pub action: MountAction,
26 pub target: MountTarget,
28}
29
30impl MountProcedure {
31 pub fn new(action: MountAction, target: MountTarget) -> Self {
33 Self { action, target }
34 }
35
36 pub fn append() -> Self {
38 Self::new(MountAction::Append, MountTarget::MountNode)
39 }
40
41 pub fn clear_append() -> Self {
43 Self::new(MountAction::ClearAppend, MountTarget::MountNode)
44 }
45
46 pub fn replace() -> Self {
48 Self::new(MountAction::Replace, MountTarget::MountNode)
49 }
50
51 pub fn append_to_shadow() -> Self {
53 Self::new(MountAction::Append, MountTarget::ShadowRoot)
54 }
55}
56
57impl Default for MountProcedure {
58 fn default() -> Self {
59 Self {
60 action: MountAction::Append,
61 target: MountTarget::MountNode,
62 }
63 }
64}