Skip to main content

WinitModifiersExt

Trait WinitModifiersExt 

Source
pub trait WinitModifiersExt: Sealed {
    // Required method
    fn to_modifiers(&self) -> Vec<Modifier>;
}
Expand description

Convert winit ModifiersState bitflags to a sorted Vec<Modifier>.

This trait is sealed and cannot be implemented outside this crate.

Required Methods§

Source

fn to_modifiers(&self) -> Vec<Modifier>

Convert these winit modifier flags to a Vec<Modifier>.

§Examples
use kbd::prelude::*;
use kbd_winit::WinitModifiersExt;
use winit::keyboard::ModifiersState;

let mods = (ModifiersState::CONTROL | ModifiersState::SHIFT).to_modifiers();
assert_eq!(mods, vec![Modifier::Ctrl, Modifier::Shift]);

Implementations on Foreign Types§

Source§

impl WinitModifiersExt for ModifiersState

Implementors§