Module iso::language

source ·
Expand description

Type definitions related to the ISO 639 language code standard

Most of this module is dedicated to the code enumerations, which each enumerate over their corresponding iso language code sets. Each can be converted into each other, provided that they have a corresponding language code in the other set.

Basic usage

// the variant representing the english language
let english = Iso639_1::En;

println!(
    "The name of the language represented by the ISO 639-3 code of {} is {}!",
    TryInto::<Iso639_3>::try_into(english).unwrap().code(),
    english.name()
);

assert_eq!(english.name(), "English");
assert_eq!(english.code(), "en");
assert_eq!(english.try_into(), Ok(Iso639_1::En));
assert_eq!(english.try_into(), Ok(Iso639_2b::Eng));
assert_eq!(english.try_into(), Ok(Iso639_2t::Eng));
assert_eq!(english.try_into(), Ok(Iso639_3::Eng));

Enums

  • A list of all possible errors encountered while working with the language code enumerations
  • Enumeration over all possible ISO 639-1 language codes
  • Enumeration over all possible ISO 639-2b language codes
  • Enumeration over all possible ISO 639-2t language codes
  • Enumeration over all possible ISO 639-3 language codes

Traits

  • An abstraction over a language code providing ways to extract information as well as convert