[−][src]Enum elefren::Language
Methods
impl Language
[src]
pub 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");
pub 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());
pub 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");
pub 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());
pub 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());
pub 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 Copy for Language
[src]
impl Clone for Language
[src]
fn clone(&self) -> Language
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Language
[src]
impl PartialEq<Language> for Language
[src]
fn eq(&self, other: &Language) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Serialize for Language
[src]
fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl Display for Language
[src]
impl Eq for Language
[src]
impl<'de> Deserialize<'de> for Language
[src]
fn deserialize<D>(
deserializer: D
) -> Result<Language, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
deserializer: D
) -> Result<Language, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl Debug for Language
[src]
impl Hash for Language
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> Erased for T
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,