summaryrefslogtreecommitdiff
path: root/crimtag
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crimtag/Cargo.toml1
-rw-r--r--crimtag/src/context.rs6
-rw-r--r--crimtag/src/lib.rs2
3 files changed, 9 insertions, 0 deletions
diff --git a/crimtag/Cargo.toml b/crimtag/Cargo.toml
index ee022ca..e48d065 100644
--- a/crimtag/Cargo.toml
+++ b/crimtag/Cargo.toml
@@ -4,3 +4,4 @@ version = "0.1.0"
4edition = "2024" 4edition = "2024"
5 5
6[dependencies] 6[dependencies]
7derive = {path="../derive"}
diff --git a/crimtag/src/context.rs b/crimtag/src/context.rs
index 15448ee..a922fd8 100644
--- a/crimtag/src/context.rs
+++ b/crimtag/src/context.rs
@@ -148,6 +148,12 @@ basic_mapped_value_from!(f32, Float32);
148basic_mapped_value_from!(f64, Float64); 148basic_mapped_value_from!(f64, Float64);
149basic_mapped_value_from!(bool, Bool); 149basic_mapped_value_from!(bool, Bool);
150 150
151impl<'a> MappedStructure<'a> for HashMap<String,String> {
152 fn get_value(&'a self, id: &str) -> Option<MappedValue<'a>> {
153 self.get(id).map(|x|MappedValue::String(x))
154 }
155}
156
151impl<'a> From<&'a String> for MappedValue<'a> { 157impl<'a> From<&'a String> for MappedValue<'a> {
152 fn from(val: &'a String ) -> MappedValue<'a> { 158 fn from(val: &'a String ) -> MappedValue<'a> {
153 MappedValue::String(val) 159 MappedValue::String(val)
diff --git a/crimtag/src/lib.rs b/crimtag/src/lib.rs
index e8f9e9f..0fe0e4e 100644
--- a/crimtag/src/lib.rs
+++ b/crimtag/src/lib.rs
@@ -9,6 +9,8 @@ mod position;
9mod error; 9mod error;
10pub mod context; 10pub mod context;
11 11
12pub use derive::CrimtagMappable;
13
12pub use error::{CrimError,CrimResult}; 14pub use error::{CrimError,CrimResult};
13pub use position::*; 15pub use position::*;
14pub use context::{Context,Value,MappedStructure,StatefulContext,MappedValue,MappedList,MappedHash}; 16pub use context::{Context,Value,MappedStructure,StatefulContext,MappedValue,MappedList,MappedHash};