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

Method add_handler

src/lib.rs:125–132  ·  view source on GitHub ↗

add a handler, return a HandlerID which you may use with keyboard.output.state().enable_handler / disable_handler / toggle_handler / is_handler_enabled by default, most handlers start in the enabled state (with the notable exception of Layers).

(&mut self, handler: Box<dyn ProcessKeys<T> + Send + 'a>)

Source from the content-addressed store, hash-verified

123 ///
124 /// by default, most handlers start in the enabled state (with the notable exception of Layers).
125 pub fn add_handler(&mut self, handler: Box<dyn ProcessKeys<T> + Send + 'a>) -> HandlerID {
126 self.output
127 .state()
128 .modifiers_and_enabled_handlers
129 .push(handler.default_enabled());
130 self.handlers.push(handler);
131 return self.output.state().modifiers_and_enabled_handlers.len() - 1;
132 }
133
134 /// predict the next or further out hander_ids returned by add_handler
135 /// Needed to add space cadets before the layers they toggle.

Callers 15

test_toggle_handlerFunction · 0.80
test_dvorak_bracketsFunction · 0.80
test_oneshot_shiftFunction · 0.80
test_oneshot_interactionFunction · 0.80
test_abortFunction · 0.80
test_oneshotFunction · 0.80
test_oneshot_timeoutFunction · 0.80
test_oneshot_double_tapFunction · 0.80
test_space_cadetFunction · 0.80

Calls 2

stateMethod · 0.80
default_enabledMethod · 0.45

Tested by 15

test_toggle_handlerFunction · 0.64
test_dvorak_bracketsFunction · 0.64
test_oneshot_shiftFunction · 0.64
test_oneshot_interactionFunction · 0.64
test_abortFunction · 0.64
test_oneshotFunction · 0.64
test_oneshot_timeoutFunction · 0.64
test_oneshot_double_tapFunction · 0.64
test_space_cadetFunction · 0.64