pub struct NumberFormat { /* private fields */ }Expand description
A decimal or percentage format shared by numeric controls and readouts.
Parsing uses the current locale’s decimal separator and digits; ASCII digits are also
accepted. Grouped input must match the locale’s grouping. Percent input may omit its sign:
40 and 40% both mean 0.4. Scientific notation, currency and units are not accepted.
Implementations§
Source§impl NumberFormat
impl NumberFormat
Sourcepub const fn percent() -> Self
pub const fn percent() -> Self
Percentage notation with no fraction digits; 0.4 displays as 40% in English.
Sourcepub const fn fraction_digits(self, digits: usize) -> Self
pub const fn fraction_digits(self, digits: usize) -> Self
Display this many fraction digits (at most 20). Parsing retains entered precision.
Sourcepub fn format(self, value: f64) -> String
pub fn format(self, value: f64) -> String
Format using the current locale, tracking locale changes in reactive closures.
Sourcepub fn format_in(self, locale: &str, value: f64) -> String
pub fn format_in(self, locale: &str, value: f64) -> String
Format in an explicit locale without subscribing to locale changes.
Trait Implementations§
Source§impl Clone for NumberFormat
impl Clone for NumberFormat
impl Copy for NumberFormat
Source§impl Debug for NumberFormat
impl Debug for NumberFormat
impl Eq for NumberFormat
Source§impl PartialEq for NumberFormat
impl PartialEq for NumberFormat
impl StructuralPartialEq for NumberFormat
Auto Trait Implementations§
impl Forget for NumberFormat
impl Freeze for NumberFormat
impl Move for NumberFormat
impl RefUnwindSafe for NumberFormat
impl Send for NumberFormat
impl Sync for NumberFormat
impl Unpin for NumberFormat
impl UnsafeUnpin for NumberFormat
impl UnwindSafe for NumberFormat
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more