pub struct DecimalFormat { /* private fields */ }Expand description
This struct allows you to print a specific number of digits before the decimal point, and after the decimal point.
This exists because the base format trait allows you to specify a width and a precision. However, in a fractional number, the width applies to the WHOLE number, including the fractional component, and doesn’t zero-pad effectively.
- The first parameter is the number of zero-padded digits before the decimal point.
- The second parameter is the number of zero-padded digits after the decimal point.
§Example:
use irox_tools::fmt::DecimalFormat;
let fmt = DecimalFormat::new(2,4);
assert_eq!("00.1235", fmt.format_f64(0.1234567));Implementations§
Auto Trait Implementations§
impl Freeze for DecimalFormat
impl RefUnwindSafe for DecimalFormat
impl Send for DecimalFormat
impl Sync for DecimalFormat
impl Unpin for DecimalFormat
impl UnwindSafe for DecimalFormat
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