aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib.rs b/src/lib.rs
index d10edd1..79941d1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -30,11 +30,18 @@ pub enum MapKind {
}
#[derive(Debug)]
-pub struct Map {
+pub struct MapAction {
pub action: Action,
pub kind: MapKind,
}
-type MapCollection = HashMap<Trigger, Map>;
+
+struct Map {
+ trigger: Trigger,
+ action: Action,
+ kind: MapKind,
+}
+
+type MapCollection = HashMap<Trigger, MapAction>;
pub struct DKMapGroup {
maps: MapCollection,
@@ -118,7 +125,7 @@ where
for (_, _, kind, _, trigger, _, action, _) in collection {
maps.insert(
trigger,
- Map {
+ MapAction {
action: action,
kind: kind,
}
@@ -199,14 +206,14 @@ cmd <down> /usr/bin/say 'hello'
let mut expected = HashMap::new();
expected.insert(
vec![HeadphoneButton::Up, HeadphoneButton::Down],
- Map {
+ MapAction {
action: "test".to_owned(),
kind: MapKind::Map,
},
);
expected.insert(
vec![HeadphoneButton::Down],
- Map {
+ MapAction {
action: "/usr/bin/say 'hello'".to_owned(),
kind: MapKind::Command,
},