Enum elefren::Language [−][src]
pub enum Language { // some variants omitted }
Methods
impl Language
[src]
impl Language
pub fn to_639_3(&self) -> &'static str
[src]
pub fn to_639_3(&self) -> &'static str
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");
pub fn to_639_1(&self) -> Option<&'static str>
[src]
pub fn to_639_1(&self) -> Option<&'static str>
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());
pub fn to_name(&self) -> &'static str
[src]
pub fn to_name(&self) -> &'static str
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");
pub fn from_639_1(code: &str) -> Option<Language>
[src]
pub fn from_639_1(code: &str) -> Option<Language>
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());
pub fn from_639_3(code: &str) -> Option<Language>
[src]
pub fn from_639_3(code: &str) -> Option<Language>
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());
pub fn from_locale(locale: &str) -> Option<Language>
[src]
pub fn from_locale(locale: &str) -> Option<Language>
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 Serialize for Language
[src]
impl Serialize for Language
fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for Language
[src]
impl<'de> Deserialize<'de> for Language
fn deserialize<D>(
deserializer: D
) -> Result<Language, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(
deserializer: D
) -> Result<Language, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Hash for Language
[src]
impl Hash for Language
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
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]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Clone for Language
[src]
impl Clone for Language
fn clone(&self) -> Language
[src]
fn clone(&self) -> Language
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Display for Language
[src]
impl Display for Language
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Debug for Language
[src]
impl Debug for Language
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Copy for Language
[src]
impl Copy for Language
impl Eq for Language
[src]
impl Eq for Language
impl PartialEq<Language> for Language
[src]
impl PartialEq<Language> for Language