pub struct Locale { /* private fields */ }Expand description
the formats of one region (copy it freely)
Implementations§
Source§impl Locale
impl Locale
Sourcepub fn get(tag: &str) -> Locale
pub fn get(tag: &str) -> Locale
the best match of a BCP 47 tag or a POSIX locale name (see the module comment)
Sourcepub fn first_weekday(&self) -> u32
pub fn first_weekday(&self) -> u32
the first day of the week: 0 = Monday .. 6 = Sunday
Sourcepub fn month_name(&self, m: u32) -> &'static str
pub fn month_name(&self, m: u32) -> &'static str
the long (format) name of month m (1..12) in the locale’s language
Sourcepub fn fmt_num(&self, v: f64, decimals: u32) -> String
pub fn fmt_num(&self, v: f64, decimals: u32) -> String
a number with exactly decimals fraction digits (rounded) and group separators
Sourcepub fn fmt_percent(&self, fraction: f64, decimals: u32) -> String
pub fn fmt_percent(&self, fraction: f64, decimals: u32) -> String
a fraction as percent: 0.25 -> “25 %” (de) / “25%” (en)
Sourcepub fn fmt_currency(&self, v: f64, code: &str) -> String
pub fn fmt_currency(&self, v: f64, code: &str) -> String
an amount of the ISO 4217 currency code (“EUR”, “USD”; unknown codes are shown as is)
Sourcepub fn fmt_size(&self, bytes: u64) -> String
pub fn fmt_size(&self, bytes: u64) -> String
a byte count: “512 B”, “1,5 KB”, “23 MB” (1024 based, one decimal below 10)
Sourcepub fn fmt_date(&self, c: &Civil, style: u32) -> String
pub fn fmt_date(&self, c: &Civil, style: u32) -> String
a date: DATE_SHORT “17.10.2026” / DATE_LONG “17. Oktober 2026”
Sourcepub fn fmt_date_time(&self, c: &Civil) -> String
pub fn fmt_date_time(&self, c: &Civil) -> String
the short date and the time: “17.10.2026, 19:58” / “10/17/2026, 7:58 PM”
Trait Implementations§
Auto Trait Implementations§
impl Forget for Locale
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§
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