Enum isolang::Language
[−]
[src]
pub enum Language { // some variants omitted }
Methods
impl Language
[src]
fn to_639_3(&self) -> &'static str
[src]
Create string representation of this Language as a ISO 639-3 code.
This method will return the ISO 639-3 code, which consists of three letters.
Example
use isolang::Language; assert_eq!(Language::Deu.to_639_3(), "deu");
fn to_639_1(&self) -> Option<&'static str>
[src]
Create two-letter ISO 639-1 representation of the language.
This will return a two-letter ISO 639-1 code, if it exists and None otherwise. ISO 639-1 codes are only used for the most common languages.
Example
use isolang::Language; assert!(Language::Gha.to_639_1().is_none());
fn to_name(&self) -> &'static str
[src]
Get the English name of this language.
This returns the English name of the language, as defined in the ISO 639 standard. It does not include additional comments, e.g. classification of a macrolanguage, etc.
Examples
use isolang::Language; assert_eq!(Language::Spa.to_name(), "Spanish"); // macro language assert_eq!(Language::Swa.to_name(), "Swahili"); // individual language assert_eq!(Language::Swh.to_name(), "Swahili");
fn from_639_1(code: &str) -> Option<Language>
[src]
Create a Language instance rom a ISO 639-1 code.
This will return a Language instance if the given string is a valid two-letter language code. For invalid inputs, None is returned.
Example
use isolang::Language; assert!(Language::from_639_1("de").is_some()); assert!(Language::from_639_1("…").is_none());
fn from_639_3(code: &str) -> Option<Language>
[src]
Create a Language instance rom a ISO 639-3 code.
This will return a Language instance if the given string is a valid three-letter language code. For invalid inputs, None is returned.
Example
use isolang::Language; assert!(Language::from_639_3("dan").is_some()); assert!(Language::from_639_1("…").is_none());
fn from_locale(locale: &str) -> Option<Language>
[src]
Parse language from given locale
This parses a language from a given locale string, as used by UNIX-alike and other systems.
Example
use isolang::Language; fn main() { assert!(Language::from_locale("de_DE.UTF-8") == Some(Language::Deu)); }
Trait Implementations
impl Clone for Language
[src]
fn clone(&self) -> Language
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Language
[src]
impl Hash for Language
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Eq for Language
[src]
impl PartialEq for Language
[src]
fn eq(&self, __arg_0: &Language) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.