KeyboardVariant

Struct KeyboardVariant 

Source
pub struct KeyboardVariant {
    pub config_item: ConfigItem,
}
Expand description

A variant of a keyboard layout.

Fields§

§config_item: ConfigItem

Implementations§

Source§

impl KeyboardVariant

Source

pub fn name(&self) -> &str

The name of this variant of a keybaord layout.

Examples found in repository?
examples/layouts.rs (line 9)
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}
Source

pub fn description(&self) -> &str

A description of this variant of a keyboard layout.

Examples found in repository?
examples/layouts.rs (line 9)
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 KeyboardVariant

Source§

fn clone(&self) -> KeyboardVariant

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KeyboardVariant

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for KeyboardVariant

Source§

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§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,