diff options
Diffstat (limited to 'crimtag')
| -rw-r--r-- | crimtag/Cargo.toml | 1 | ||||
| -rw-r--r-- | crimtag/src/context.rs | 6 | ||||
| -rw-r--r-- | crimtag/src/lib.rs | 2 |
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" | |||
| 4 | edition = "2024" | 4 | edition = "2024" |
| 5 | 5 | ||
| 6 | [dependencies] | 6 | [dependencies] |
| 7 | derive = {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); | |||
| 148 | basic_mapped_value_from!(f64, Float64); | 148 | basic_mapped_value_from!(f64, Float64); |
| 149 | basic_mapped_value_from!(bool, Bool); | 149 | basic_mapped_value_from!(bool, Bool); |
| 150 | 150 | ||
| 151 | impl<'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 | |||
| 151 | impl<'a> From<&'a String> for MappedValue<'a> { | 157 | impl<'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; | |||
| 9 | mod error; | 9 | mod error; |
| 10 | pub mod context; | 10 | pub mod context; |
| 11 | 11 | ||
| 12 | pub use derive::CrimtagMappable; | ||
| 13 | |||
| 12 | pub use error::{CrimError,CrimResult}; | 14 | pub use error::{CrimError,CrimResult}; |
| 13 | pub use position::*; | 15 | pub use position::*; |
| 14 | pub use context::{Context,Value,MappedStructure,StatefulContext,MappedValue,MappedList,MappedHash}; | 16 | pub use context::{Context,Value,MappedStructure,StatefulContext,MappedValue,MappedList,MappedHash}; |
