aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cocoa_bridge.rs22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs
index 22fcc58..541abe7 100644
--- a/src/cocoa_bridge.rs
+++ b/src/cocoa_bridge.rs
@@ -64,20 +64,16 @@ impl<'a> KeyActionResult<'a> {
}
}
- fn with_action(&mut self, action: &str) -> &Self {
+ fn with_action(mut self, action: &str) -> Self {
let action = CString::new(action.clone()).unwrap();
self.action = Some(action);
self
}
- fn in_mode(&mut self, mode: &'a [HeadphoneButton]) -> &Self {
+ fn in_mode(mut self, mode: &'a [HeadphoneButton]) -> Self {
self.in_mode = Some(mode);
self
}
-
- fn build(&self) -> Self {
- *self
- }
}
#[repr(C)]
@@ -159,14 +155,14 @@ map <play><down> works!
return match map.kind {
MapKind::Map => {
Some(
- *KeyActionResult::new(MapKind::Map)
+ KeyActionResult::new(MapKind::Map)
.with_action(&map.action)
.in_mode(trigger)
)
},
MapKind::Command => {
Some(
- *KeyActionResult::new(MapKind::Command)
+ KeyActionResult::new(MapKind::Command)
.in_mode(trigger)
)
},
@@ -186,22 +182,12 @@ map <play><down> works!
Some(
KeyActionResult::new(MapKind::Map)
.with_action(&map.action)
- .build()
)
- // Some(KeyActionResult {
- // action: Some(action),
- // kind: MapKind::Map,
- // })
},
MapKind::Command => {
Some(
KeyActionResult::new(MapKind::Command)
- .build()
)
- // Some(KeyActionResult {
- // action: None,
- // kind: MapKind::Command,
- // })
},
}
}