pub struct KeyboardLayout {
pub config_item: ConfigItem,
pub variant_list: Option<VariantList>,
}Expand description
A keyboard layout, which contains an optional list of variants, a name, and a description.
Fields§
§config_item: ConfigItem§variant_list: Option<VariantList>Implementations§
Source§impl KeyboardLayout
impl KeyboardLayout
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Fetches the name of the keyboard layout.
Examples found in repository?
examples/layouts.rs (line 6)
1fn main() {
2 println!("Keyboard layouts");
3 let layouts = xkb_data::keyboard_layouts().unwrap();
4 let mut count = 0;
5 for layout in layouts.layouts() {
6 println!(" {}: {}", layout.name(), layout.description());
7 if let Some(variants) = layout.variants() {
8 for variant in variants {
9 println!(" {}: {}", variant.name(), variant.description())
10 }
11 }
12 count += 1;
13 }
14
15 println!("Total layouts without extra sources: {}", count);
16
17 count = 0;
18 let all_layouts = xkb_data::all_keyboard_layouts().unwrap();
19 for layout in all_layouts.layouts() {
20 println!(" {}: {}", layout.name(), layout.description());
21 if let Some(variants) = layout.variants() {
22 for variant in variants {
23 println!(" {}: {}", variant.name(), variant.description())
24 }
25 }
26 count += 1;
27 }
28 println!("Total layouts including extra sources: {}", count);
29}Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Fetches a description of the layout.
Examples found in repository?
examples/layouts.rs (line 6)
1fn main() {
2 println!("Keyboard layouts");
3 let layouts = xkb_data::keyboard_layouts().unwrap();
4 let mut count = 0;
5 for layout in layouts.layouts() {
6 println!(" {}: {}", layout.name(), layout.description());
7 if let Some(variants) = layout.variants() {
8 for variant in variants {
9 println!(" {}: {}", variant.name(), variant.description())
10 }
11 }
12 count += 1;
13 }
14
15 println!("Total layouts without extra sources: {}", count);
16
17 count = 0;
18 let all_layouts = xkb_data::all_keyboard_layouts().unwrap();
19 for layout in all_layouts.layouts() {
20 println!(" {}: {}", layout.name(), layout.description());
21 if let Some(variants) = layout.variants() {
22 for variant in variants {
23 println!(" {}: {}", variant.name(), variant.description())
24 }
25 }
26 count += 1;
27 }
28 println!("Total layouts including extra sources: {}", count);
29}Sourcepub fn variants(&self) -> Option<&Vec<KeyboardVariant>>
pub fn variants(&self) -> Option<&Vec<KeyboardVariant>>
Fetches a list of possible layout variants.
Examples found in repository?
examples/layouts.rs (line 7)
1fn main() {
2 println!("Keyboard layouts");
3 let layouts = xkb_data::keyboard_layouts().unwrap();
4 let mut count = 0;
5 for layout in layouts.layouts() {
6 println!(" {}: {}", layout.name(), layout.description());
7 if let Some(variants) = layout.variants() {
8 for variant in variants {
9 println!(" {}: {}", variant.name(), variant.description())
10 }
11 }
12 count += 1;
13 }
14
15 println!("Total layouts without extra sources: {}", count);
16
17 count = 0;
18 let all_layouts = xkb_data::all_keyboard_layouts().unwrap();
19 for layout in all_layouts.layouts() {
20 println!(" {}: {}", layout.name(), layout.description());
21 if let Some(variants) = layout.variants() {
22 for variant in variants {
23 println!(" {}: {}", variant.name(), variant.description())
24 }
25 }
26 count += 1;
27 }
28 println!("Total layouts including extra sources: {}", count);
29}Trait Implementations§
Source§impl Clone for KeyboardLayout
impl Clone for KeyboardLayout
Source§fn clone(&self) -> KeyboardLayout
fn clone(&self) -> KeyboardLayout
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KeyboardLayout
impl Debug for KeyboardLayout
Source§impl<'de> Deserialize<'de> for KeyboardLayout
impl<'de> Deserialize<'de> for KeyboardLayout
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for KeyboardLayout
impl RefUnwindSafe for KeyboardLayout
impl Send for KeyboardLayout
impl Sync for KeyboardLayout
impl Unpin for KeyboardLayout
impl UnwindSafe for KeyboardLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more