From e1a688efb16f96a6dca3678c67ff38b7cabfa8c6 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 7 Jul 2026 15:10:21 -0700 Subject: More augments and setup for use from other crates. --- crimtag/Cargo.toml | 1 + crimtag/src/context.rs | 6 ++++++ crimtag/src/lib.rs | 2 ++ 3 files changed, 9 insertions(+) (limited to 'crimtag') 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" edition = "2024" [dependencies] +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); basic_mapped_value_from!(f64, Float64); basic_mapped_value_from!(bool, Bool); +impl<'a> MappedStructure<'a> for HashMap { + fn get_value(&'a self, id: &str) -> Option> { + self.get(id).map(|x|MappedValue::String(x)) + } +} + impl<'a> From<&'a String> for MappedValue<'a> { fn from(val: &'a String ) -> MappedValue<'a> { 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; mod error; pub mod context; +pub use derive::CrimtagMappable; + pub use error::{CrimError,CrimResult}; pub use position::*; pub use context::{Context,Value,MappedStructure,StatefulContext,MappedValue,MappedList,MappedHash}; -- cgit v1.2.3