Skip to main content

UsbKeyboard

Struct UsbKeyboard 

Source
pub struct UsbKeyboard<L>
where L: KeyboardLayout,
{ /* private fields */ }
Expand description

Encapsulates HID frame handling, and handles state transitions and key events for USB HID Keyboards

Implementations§

Source§

impl<L> UsbKeyboard<L>
where L: KeyboardLayout,

Source

pub fn new(layout: L, handle_ctrl: HandleControl) -> UsbKeyboard<L>

Construct USB HID keyboard handler

Source

pub fn reset_state(&mut self)

Reset the USB HID state

We only get changes in key state from the keyboard, so this function resets our internal state.

Source

pub fn handle_report_raw<'kb>( &'kb mut self, report: &UsbBootKeyboardReport, ) -> UsbKeyEventIter<'kb, L>

Process a new USB HID Frame into KeyEvents

You are given an iterator, which will process the incoming report. Do not drop the iterator until it starts returning None.

Source

pub fn handle_report<'kb>( &'kb mut self, report: &UsbBootKeyboardReport, ) -> UsbDecodedKeyIter<'kb, L>

Process a new USB HID Frame into Decoded keys

You are given an iterator, which will process the incoming report. Do not drop the iterator until it starts returning None.

Trait Implementations§

Source§

impl<L> Debug for UsbKeyboard<L>
where L: KeyboardLayout + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<L> Freeze for UsbKeyboard<L>
where L: Freeze,

§

impl<L> RefUnwindSafe for UsbKeyboard<L>
where L: RefUnwindSafe,

§

impl<L> Send for UsbKeyboard<L>
where L: Send,

§

impl<L> Sync for UsbKeyboard<L>
where L: Sync,

§

impl<L> Unpin for UsbKeyboard<L>
where L: Unpin,

§

impl<L> UnsafeUnpin for UsbKeyboard<L>
where L: UnsafeUnpin,

§

impl<L> UnwindSafe for UsbKeyboard<L>
where L: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.