So today, Precision::Decimals works like this:
# use numfmt::*;
let mut f = Formatter::new() // start with blank representation
.separator(',').unwrap()
.prefix("AU$").unwrap()
.precision(Precision::Decimals(2));
assert_eq!(f.fmt(12345678900.0), "AU$12,345,678,900.0");
But sometimes (especially whit money), trailing zeros are needed. So it would be great if we had something like this:
# use numfmt::*;
let mut f = Formatter::new() // start with blank representation
.separator(',').unwrap()
.prefix("AU$").unwrap()
.precision(Precision::Always(2));
assert_eq!(f.fmt(12345678900.0), "AU$12,345,678,900.00");
So today, Precision::Decimals works like this:
But sometimes (especially whit money), trailing zeros are needed. So it would be great if we had something like this: