pub struct Layout {
pub name: &'static str,
pub entries: &'static [Entry],
pub decimal_separator: char,
}Expand description
A keyboard layout: a table of positions, and the decimal key’s character.
Fields§
§name: &'static strHuman-readable name, for logging what a device is being read as.
entries: &'static [Entry]Positions, in no particular order. Looked up by linear scan: about fifty comparisons, at most a few times per second, against the complexity of keeping a sorted table sorted.
decimal_separator: charWhat the numpad’s decimal key types. . in most of the world, , in most
of Europe.
Implementations§
Source§impl Layout
impl Layout
Sourcepub fn entry(&self, code: KeyCode) -> Option<&'static Entry>
pub fn entry(&self, code: KeyCode) -> Option<&'static Entry>
What this layout puts on one position, at each of its four levels.
None for a position no layout describes. Positions the layout does not
list fall back to the shared letter table, so a layout only spells out
what it moves — which is why Layout::entry answers for KeyCode::A on
a table that never mentions it.
An on-screen keyboard reads this to letter its keys: the caller picks the level from the modifiers it is currently showing.