[−][src]Struct keytokey::handlers::OneShot
A OneShot key. Press it, on_activate will be called.
on_deactivate will be called after the next non-oneshot key release or if the OneShot trigger is pressed again
Also, if the OneShot trigger is pressed again on_double_tap_trigger1/2 is called (after callbacks.on_deactivate, use ActionNone for no action)
If held_timeout is > 0 and the key is pressed for at least that many ms, and on_deactivate will be called upon release. This typically is useful for graphics work where the user presses the modifiers while interacting with the mouse.
You may also define a released_timeout - after this time, without a different keypress, the OneShot will also deactivate.
OneShots have two triggers to accomodate the usual left/right modifier keys, just pass in Keycode::No if you want one trigger to be ignored.
Note that the oneshots always lead to the left variant of the modifier being sent, even if they're being triggered by the right one.
Implementations
impl<M1: OnOff, M2: Action, M3: Action> OneShot<M1, M2, M3>
[src]
pub fn new(
trigger1: impl AcceptsKeycode,
trigger2: impl AcceptsKeycode,
callbacks: M1,
on_double_tap_trigger1: M2,
on_double_tap_trigger2: M3,
held_timeout: u16,
released_timeout: u16
) -> OneShot<M1, M2, M3>
[src]
trigger1: impl AcceptsKeycode,
trigger2: impl AcceptsKeycode,
callbacks: M1,
on_double_tap_trigger1: M2,
on_double_tap_trigger2: M3,
held_timeout: u16,
released_timeout: u16
) -> OneShot<M1, M2, M3>
Trait Implementations
impl<T: USBKeyOut, M1: OnOff, M2: Action, M3: Action> ProcessKeys<T> for OneShot<M1, M2, M3>
[src]
fn process_keys(
&mut self,
events: &mut Vec<(Event, EventStatus)>,
output: &mut T
) -> HandlerResult
[src]
&mut self,
events: &mut Vec<(Event, EventStatus)>,
output: &mut T
) -> HandlerResult
fn default_enabled(&self) -> bool
[src]
Auto Trait Implementations
impl<M1, M2, M3> Send for OneShot<M1, M2, M3> where
M1: Send,
M2: Send,
M3: Send,
M1: Send,
M2: Send,
M3: Send,
impl<M1, M2, M3> Sync for OneShot<M1, M2, M3> where
M1: Sync,
M2: Sync,
M3: Sync,
M1: Sync,
M2: Sync,
M3: Sync,
impl<M1, M2, M3> Unpin for OneShot<M1, M2, M3> where
M1: Unpin,
M2: Unpin,
M3: Unpin,
M1: Unpin,
M2: Unpin,
M3: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,