pub struct DecimalFormatF32(pub usize, pub usize, pub f32);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::DecimalFormatF32;
assert_eq!("00.1235", format!("{}", DecimalFormatF32(2,4,0.1234567)));Tuple Fields§
§0: usize§1: usize§2: f32Trait Implementations§
Auto Trait Implementations§
impl Freeze for DecimalFormatF32
impl RefUnwindSafe for DecimalFormatF32
impl Send for DecimalFormatF32
impl Sync for DecimalFormatF32
impl Unpin for DecimalFormatF32
impl UnwindSafe for DecimalFormatF32
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