pub struct KeyBind {
pub keycode: KeySym,
pub mods: Vec<Mod>,
pub trigger: Trigger,
pub function: FunctionCall,
}Fields§
§keycode: KeySym§mods: Vec<Mod>§trigger: Trigger§function: FunctionCallImplementations§
Source§impl KeyBind
impl KeyBind
Sourcepub fn new(
keycode: u32,
mods: Vec<Mod>,
trigger: Trigger,
function: FunctionCall,
) -> Self
pub fn new( keycode: u32, mods: Vec<Mod>, trigger: Trigger, function: FunctionCall, ) -> Self
Examples found in repository?
examples/intro.rs (lines 10-15)
5fn main(){
6 // create new KeyStorage
7 let mut storage = KeyStorage::new();
8
9 // Call crtl_a_pressed when Control + a is pressed
10 let ctrl_a = KeyBind::new(
11 keysym::XK_a,
12 vec![Mod::Control],
13 Trigger::Pressed,
14 ctrl_a_pressed,
15 );
16
17 // Call crtl-alt_a_pressed when Control + Alt + a is pressed
18 let ctrl_alt_a = KeyBind::new(
19 keysym::XK_a,
20 vec![Mod::Control, Mod::Alt],
21 Trigger::Pressed,
22 ctrl_alt_a_pressed,
23 );
24
25 // Add KeyBinds to storage
26 storage.add(ctrl_a);
27 storage.add(ctrl_alt_a);
28
29 // start storage
30 storage.start();
31}Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyBind
impl RefUnwindSafe for KeyBind
impl Send for KeyBind
impl Sync for KeyBind
impl Unpin for KeyBind
impl UnwindSafe for KeyBind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more