[−][src]Struct keytokey::Keyboard
the main keyboard struct
add handlers wit add_handler, then call add_keypress/add_key_release/add_timeout to start processing keys.
Fields
output: T
Implementations
impl<'a, T: USBKeyOut> Keyboard<'a, T>
[src]
pub fn new(output: T) -> Keyboard<'a, T>
[src]
pub fn add_handler(
&mut self,
handler: Box<dyn ProcessKeys<T> + Send + 'a>
) -> HandlerID
[src]
&mut self,
handler: Box<dyn ProcessKeys<T> + Send + 'a>
) -> HandlerID
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).
pub fn future_handler_id(&self, offset: usize) -> HandlerID
[src]
predict the next or further out hander_ids returned by add_handler Needed to add space cadets before the layers they toggle.
pub fn handle_keys(&mut self) -> Result<(), ()>
[src]
handle an update to the event stream
This returns OK(()) if all keys are handled by the handlers and an Err(()) otherwise. that way the down stream can decide what to do (tests: panic. Firmare/MatrixToStream -> drop unhandled events)
pub fn clear_unhandled(&mut self)
[src]
pub fn add_keypress<X: AcceptsKeycode>(
&mut self,
keycode: X,
ms_since_last: u16
)
[src]
&mut self,
keycode: X,
ms_since_last: u16
)
add a KeyPress event
pub fn add_keyrelease<X: AcceptsKeycode>(
&mut self,
keycode: X,
ms_since_last: u16
)
[src]
&mut self,
keycode: X,
ms_since_last: u16
)
add a KeyRelease event
pub fn add_timeout(&mut self, ms_since_last: u16)
[src]
Auto Trait Implementations
impl<'a, T> Send for Keyboard<'a, T> where
T: Send,
T: Send,
impl<'a, T> !Sync for Keyboard<'a, T>
impl<'a, T> Unpin for Keyboard<'a, T> where
T: Unpin,
T: 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>,