summaryrefslogtreecommitdiff
path: root/src/template.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-04-05 20:04:33 +0200
committertroido <troido@protonmail.com>2020-04-05 20:04:33 +0200
commit48c24ec8b011d081550dc78329cbe61de67b30e9 (patch)
treed2d700897dc5ba3d0f52e8a1cd57c0f4880272fd /src/template.rs
parent84c70cee089b72720a85d285ee0437b65be298b9 (diff)
items are now mostly replaced by itemids, with a mapping to the item in the encyclopedia
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()));