summaryrefslogtreecommitdiff
path: root/src/template.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/template.rs')
-rw-r--r--src/template.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/template.rs b/src/template.rs
index 496d08e..0f62754 100644
--- a/src/template.rs
+++ b/src/template.rs
@@ -31,15 +31,24 @@ impl Template {
}
}
+ pub fn empty(name: &str) -> Self {
+ Self::new(name, HashMap::new())
+ }
+
+ pub fn from_entity_type(typ: EntityType) -> Self {
+ Self {
+ name: typ,
+ args: Vec::new(),
+ kwargs: HashMap::new(),
+ save: true
+ }
+ }
+
pub fn unsaved(mut self) -> Self {
self.save = false;
self
}
- pub fn empty(name: &str) -> Self {
- Self::new(name, HashMap::new())
- }
-
pub fn from_json(val: &Value) -> Result<Template> {
if val.is_string(){
return Ok(Self::empty(val.as_str().unwrap()));