pub struct Keybind { /* private fields */ }Implementations§
Source§impl Keybind
impl Keybind
Sourcepub fn new(keys: &[Keycode]) -> Keybind
pub fn new(keys: &[Keycode]) -> Keybind
Sourcepub fn on_trigger<C: Fn() + 'static>(&mut self, callback: C)
pub fn on_trigger<C: Fn() + 'static>(&mut self, callback: C)
Sourcepub fn wait(&mut self)
pub fn wait(&mut self)
Starts an infinite loop and calls provided callback when the keybind is triggered.
§Example
ⓘ
use keybind::{Keybind, Keycode};
fn main() {
let mut keybind = Keybind::new(&[Keycode::LControl, Keycode::G]);
keybind.on_trigger(|| {
println!("This will be printed when you press CTRL+G");
});
keybind.wait();
}Auto Trait Implementations§
impl !RefUnwindSafe for Keybind
impl !Send for Keybind
impl !Sync for Keybind
impl !UnwindSafe for Keybind
impl Freeze for Keybind
impl Unpin for Keybind
impl UnsafeUnpin 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