Struct pc_keyboard::EventDecoder

source ·
pub struct EventDecoder<L>
where L: KeyboardLayout,
{ /* private fields */ }
Expand description

Converts KeyEvents into Unicode, according to the current Keyboard Layout

Implementations§

source§

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

source

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

Construct a new event decoder.

source

pub fn set_ctrl_handling(&mut self, new_value: HandleControl)

Change the Ctrl key mapping.

source

pub const fn get_ctrl_handling(&self) -> HandleControl

Get the current Ctrl key mapping.

source

pub fn process_keyevent(&mut self, ev: KeyEvent) -> Option<DecodedKey>

Processes a KeyEvent returned from add_bit, add_byte or add_word and produces a decoded key.

For example, the KeyEvent for pressing the ‘5’ key on your keyboard gives a DecodedKey of unicode character ‘5’, unless the shift key is held in which case you get the unicode character ‘%’.

source

pub fn change_layout(&mut self, new_layout: L)

Change the keyboard layout.

Only useful with layouts::AnyLayout, otherwise you can only change a layout for exactly the same layout.

Trait Implementations§

source§

impl<L> Debug for EventDecoder<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 EventDecoder<L>
where L: Freeze,

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.