[][src]Struct keytokey::handlers::OneShot

pub struct OneShot<M1, M2, M3> { /* fields omitted */ }

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]

Trait Implementations

impl<T: USBKeyOut, M1: OnOff, M2: Action, M3: Action> ProcessKeys<T> for OneShot<M1, M2, M3>[src]

Auto Trait Implementations

impl<M1, M2, M3> Send for OneShot<M1, M2, M3> where
    M1: Send,
    M2: Send,
    M3: Send

impl<M1, M2, M3> Sync for OneShot<M1, M2, M3> where
    M1: Sync,
    M2: Sync,
    M3: Sync

impl<M1, M2, M3> Unpin for OneShot<M1, M2, M3> where
    M1: Unpin,
    M2: Unpin,
    M3: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.