Type Alias usb_ids::Language

source ·
pub type Language = UsbIdWithChildren<u16, Dialect>;
Expand description

Represents a language type in the USB database.

Languages have a language ID, a pretty name, and a list of associated Dialects.

use usb_ids::{Language, FromId};
let language = Language::from_id(0x000c).unwrap();
assert_eq!(language.name(), "French");

for dialect in language.dialects() {
  println!("dialect: {}", dialect.name());
}

Aliased Type§

struct Language { /* private fields */ }

Implementations§

source§

impl Language

source

pub fn dialects(&self) -> impl Iterator<Item = &'static Dialect>

Returns an iterator over the language’s Dialects.

Trait Implementations§

source§

impl FromId<u16> for Language

source§

fn from_id(id: u16) -> Option<&'static Self>

Returns the entity corresponding to id, or None if none exists.