aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2018-08-08 05:39:19 +0200
committerTeddy Wing2018-08-08 05:39:19 +0200
commit98f951add465f5c298cbf9179db3a3af36fe967d (patch)
tree1587100f98c7939a7353b4e8d99ff8bde6bfbadf /src
parent20ed9e16aeda341d172fbbaa4fc17e4364119445 (diff)
downloaddome-key-map-98f951add465f5c298cbf9179db3a3af36fe967d.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs11
1 files changed, 7 insertions, 4 deletions
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<Trigger, Action>,
- modes: HashMap<Trigger, Map>,
+ maps: HashMap<Trigger, Map>,
+ modes: HashMap<Trigger, HashMap<Trigger, Map>>,
}
#[cfg(test)]