greenback
Library for safely handling USD values as integers
Installation
Edit Cargo.toml
:
[]
="0.0.3"
Usage
extern crate greenback;
use Greenback;
Output:
Total cost: $107.90
sum: $9.29
Status
This is my first Rust package and I'm still learning Rust so user beware!
Pull requests and issues are very welcome.
All the basic arithmetic operations (Add, AddMul, Sub, SubMul, etc.) are implemented along with ordering and summing. There's also a default formatter which will print your money values like $1,234.56
. There's no overflow detection and only limited support for Mul and Div traits. I need to figure out how to do these using generics properly.