pub struct Locale {
pub decimal_point: char,
pub thousands_sep: Option<char>,
pub grouping: [u8; 4],
pub group_repeat: bool,
}Expand description
The numeric locale. Note this is a pure value type.
Fields§
§decimal_point: charThe decimal point. Only single-char decimal points are supported.
thousands_sep: Option<char>The thousands separator, or None if none. Note some obscure locales like it_IT.ISO8859-15 seem to have a multi-char thousands separator! We do not support that.
grouping: [u8; 4]The grouping of digits. This is to be read from left to right. For example, the number 88888888888888 with a grouping of [2, 3, 4, 4] would produce the string “8,8888,8888,888,88”. If 0, no grouping at all.
group_repeat: boolIf true, the group is repeated. If false, there are no groups after the last.
Implementations§
Source§impl Locale
impl Locale
Sourcepub fn apply_grouping(&self, input: &str) -> String
pub fn apply_grouping(&self, input: &str) -> String
Given a string containing only ASCII digits, return a new string with thousands separators applied. This panics if the locale has no thousands separator; callers should only call this if there is a thousands separator.
pub fn separator_count(&self, digits_count: usize) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Locale
impl RefUnwindSafe for Locale
impl Send for Locale
impl Sync for Locale
impl Unpin for Locale
impl UnwindSafe for Locale
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)