Lang

Enum Lang 

Source
pub enum Lang {
    English,
    French,
    French_BE,
    French_CH,
    Ukrainian,
}
Expand description

Languages available in num2words

Variants§

§

English

use num2words::{Num2Words, Lang};
assert_eq!(
    Num2Words::new(42).lang(Lang::English).to_words(),
    Ok(String::from("forty-two"))
);
§

French

French from France and Canada

use num2words::{Num2Words, Lang};
assert_eq!(
    Num2Words::new(42).lang(Lang::French).to_words(),
    Ok(String::from("quarante-deux"))
);
§

French_BE

French from Belgium and the Democratic Republic of the Congo

use num2words::{Num2Words, Lang};
assert_eq!(
    Num2Words::new(70).lang(Lang::French_BE).to_words(),
    Ok(String::from("septante"))
);
§

French_CH

French from Swiss Confederation and Aosta Valley (Italy)

use num2words::{Num2Words, Lang};
assert_eq!(
    Num2Words::new(80).lang(Lang::French_CH).to_words(),
    Ok(String::from("huitante"))
);
§

Ukrainian

use num2words::{Num2Words, Lang};
assert_eq!(
    Num2Words::new(42).lang(Lang::Ukrainian).to_words(),
    Ok(String::from("сорок два"))
);

Trait Implementations§

Source§

impl FromStr for Lang

Source§

fn from_str(input: &str) -> Result<Self, Self::Err>

Parses a string to return a value of this type

LocaleLang42
enLang::Englishforty-two
frLang::Frenchquarante-deux
fr_BELang::French_BEquarante-deux
fr_CHLang::French_CHquarante-deux
ukLang::Ukrainianсорок два
Source§

type Err = ()

The associated error which can be returned from parsing.

Auto Trait Implementations§

§

impl Freeze for Lang

§

impl RefUnwindSafe for Lang

§

impl Send for Lang

§

impl Sync for Lang

§

impl Unpin for Lang

§

impl UnwindSafe for Lang

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.