akubera / bigdecimal-rs

Arbitrary precision decimal crate for Rust
Other
292 stars 72 forks source link

use fmt::Formatter::pad_integral to implement number style width/padding #37

Closed thargor closed 6 years ago

thargor commented 6 years ago

After trying #36 I found that it does not handle alignment correctly.

I therefore reimplemented it with number-like width/padding formatting and some more tests.

This uses fmt::Formatter::pad_integral, which is intended for integrals but works perfectly fine for decimals if precision is handled before. If required I also have an implementation which does not use pad_integral, but it requires nightly to get access to the format alignments.

akubera commented 6 years ago

Thanks a lot!