summaryrefslogtreecommitdiff
path: root/src/types/rendered_element.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/types/rendered_element.rs')
-rw-r--r--src/types/rendered_element.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/types/rendered_element.rs b/src/types/rendered_element.rs
index e909ac5..cbc923d 100644
--- a/src/types/rendered_element.rs
+++ b/src/types/rendered_element.rs
@@ -1,11 +1,15 @@
+use std::collections::HashMap;
+
use unique_id::{string::StringGenerator, Generator};
-use super::{props::Props, ElementName};
+use super::ElementName;
+
+#[derive(Debug)]
pub struct RenderedElement {
pub id: String,
pub child_elements: Vec<RenderedElement>,
pub name: ElementName,
- pub props: Props,
+ pub props: HashMap<&'static str, &'static str>,
}
impl RenderedElement {
@@ -15,7 +19,7 @@ impl RenderedElement {
id: gen.next_id(),
child_elements: vec![],
name,
- props: Props::default(),
+ props: HashMap::new(),
}
}
@@ -25,7 +29,7 @@ impl RenderedElement {
id: gen.next_id(),
child_elements,
name,
- props: Props::default(),
+ props: HashMap::new(),
}
}
@@ -33,4 +37,9 @@ impl RenderedElement {
self.child_elements.push(element);
self
}
+
+ pub fn set_property(&mut self, prop: &'static str, value: &'static str) {
+ let prop_ref = self.props.entry(prop).or_insert(value);
+ *prop_ref = value;
+ }
}