simple_money-0.2.0 has been yanked.
Brief description
"Down-to-earth" (explained further below) money [^fowler] and currency implementation written in Rust.
See further below for more detailed design considerations. [^fowler]: Money consists of an amount and a Currency, as described by Martin Fowler in his Money EAA Pattern.
Usage
# use ;
# use Money;
#
Other implementations
Simple Money has similar implementations in other programming languages. There's a Simple Money project page on BitBucket, but I haven't published all of them.
Comparison to similar libraries
Here are two alternatives I've found:
- steel-cent
- uses an i64 for the amount, just like this implementation
- has the same precision as the minor amount allows (no "half Cents")
- its currency has the
Copytrait and is as small as mine - the ISO currencies are provided, but IntelliJ's Rust plugin fails to see them (works in the terminal though)
- rusty-money:
- uses its own 128 representation for the amount
- has more precision than available by the minor amount
- its currency...
- has lots of fields, ...
- ... but the ISO currencies are provided ready to use
- has the
Copytrait, but is eighty bytes in size
- is bristling with features (e.g. exchange rates?)