diff options
| author | Teddy Wing | 2018-08-08 05:39:19 +0200 |
|---|---|---|
| committer | Teddy Wing | 2018-08-08 05:39:19 +0200 |
| commit | 98f951add465f5c298cbf9179db3a3af36fe967d (patch) | |
| tree | 1587100f98c7939a7353b4e8d99ff8bde6bfbadf /src | |
| parent | 20ed9e16aeda341d172fbbaa4fc17e4364119445 (diff) | |
| download | dome-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.rs | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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)] |
