rbx_rsml/parser/tree_node_group/
tree_node.rs1use std::collections::HashMap;
2use rbx_types::Attributes;
3
4use crate::Datatype;
5
6#[derive(Debug)]
7pub struct TreeNode {
8 pub selector: Option<String>,
9 pub name: Option<String>,
10 pub priority: Option<i32>,
11 pub tweens: HashMap<String, Datatype>,
12 pub attributes: Attributes,
13 pub static_attributes: HashMap<String, Datatype>,
14 pub properties: Attributes,
15 pub child_rules: Vec<usize>,
16 pub parent: TreeNodeType
17}
18
19#[derive(Clone, PartialEq, Copy, Eq, Debug, Hash)]
20pub enum TreeNodeType {
21 Root,
22 Node(usize)
23}
24
25impl TreeNode {
26 pub fn new(parent: TreeNodeType, selector: Option<String>) -> Self {
27 Self {
28 attributes: Attributes::new(),
29 static_attributes: HashMap::new(),
30 properties: Attributes::new(),
31 child_rules: vec![],
32 priority: None,
33 name: None,
34 tweens: HashMap::new(),
35 selector,
36 parent
37 }
38 }
39}