MCPcopy Create free account
hub / github.com/TyberiusPrime/KeyToKey / new

Method new

src/handlers/oneshot.rs:54–75  ·  view source on GitHub ↗
(
        trigger1: impl AcceptsKeycode,
        trigger2: impl AcceptsKeycode,
        callbacks: M1,
        on_double_tap_trigger1: M2,
        on_double_tap_trigger2: M3,
        held_timeout: u16

Source from the content-addressed store, hash-verified

52}
53impl<M1: OnOff, M2: Action, M3: Action> OneShot<M1, M2, M3> {
54 pub fn new(
55 trigger1: impl AcceptsKeycode,
56 trigger2: impl AcceptsKeycode,
57 callbacks: M1,
58 on_double_tap_trigger1: M2,
59 on_double_tap_trigger2: M3,
60 held_timeout: u16,
61 released_timeout: u16,
62 ) -> OneShot<M1, M2, M3> {
63 ONESHOT_TRIGGERS.write().push(trigger1.to_u32());
64 ONESHOT_TRIGGERS.write().push(trigger2.to_u32());
65 OneShot {
66 trigger1: trigger1.to_u32(),
67 trigger2: trigger2.to_u32(),
68 callbacks,
69 on_double_tap_trigger1,
70 on_double_tap_trigger2,
71 status: OneShotStatus::Off,
72 held_timeout,
73 released_timeout,
74 }
75 }
76}
77impl<T: USBKeyOut, M1: OnOff, M2: Action, M3: Action> ProcessKeys<T> for OneShot<M1, M2, M3> {
78 fn process_keys(&mut self, events: &mut Vec<(Event, EventStatus)>, output: &mut T) -> HandlerResult {

Callers

nothing calls this directly

Calls 1

to_u32Method · 0.80

Tested by

no test coverage detected