pub struct Locale {
pub tag: &'static str,
/* private fields */
}Expand description
How numbers are written in one locale.
Fields§
§tag: &'static strThe tag as written (de-DE), for messages.
Implementations§
Source§impl Locale
impl Locale
Sourcepub fn parse(tag: &str) -> Result<Locale, String>
pub fn parse(tag: &str) -> Result<Locale, String>
The conventions for a BCP 47 tag like de, de-DE or pt_BR: its language-region
entry, else its language’s.
Sourcepub fn number(&self, x: f64, decimals: usize) -> String
pub fn number(&self, x: f64, decimals: usize) -> String
x rounded half away from zero to decimals places, with group and decimal separators.
Negative numbers get a leading -.
Sourcepub fn format_number(&self, x: f64, decimals: usize, group: bool) -> String
pub fn format_number(&self, x: f64, decimals: usize, group: bool) -> String
As Locale::number, with or without group separators (an Excel format without ,).
pub fn percent(&self, x: f64, decimals: usize) -> String
pub fn currency(&self, x: f64, code: &str, decimals: usize) -> String
Trait Implementations§
impl Copy for Locale
impl Eq for Locale
impl StructuralPartialEq for Locale
Auto Trait Implementations§
impl Freeze for Locale
impl RefUnwindSafe for Locale
impl Send for Locale
impl Sync for Locale
impl Unpin for Locale
impl UnsafeUnpin for Locale
impl UnwindSafe for Locale
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.