From 98f951add465f5c298cbf9179db3a3af36fe967d Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 8 Aug 2018 05:39:19 +0200 Subject: Make map `kind` an enum; Fix `modes` type The `kind` has a specific set of things that it can be. It didn't need to be a `String`. Fix `DKMapGroup.modes` to ensure that values are map hashes. Remove `trigger` from `Map` because it didn't make sense to include it in the `HashMap` value if it's the hash key. --- src/lib.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 14db49b..10ad25d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,16 +4,19 @@ use std::collections::HashMap; type Trigger = String; type Action = String; +pub enum MapKind { + Map, + Command, +} pub struct Map { - pub trigger: Trigger, pub action: Action, - pub kind: String, + pub kind: MapKind, } pub struct DKMapGroup { - maps: HashMap, - modes: HashMap, + maps: HashMap, + modes: HashMap>, } #[cfg(test)] -- cgit v1.2.3