lucre
An ergonomic Rust library for handling money.
Represent money in your applications without fussing over generics or lifetimes, while still being safe and fast. ISO 4217 currency definitions are built in.
Install
Add lucre to your Cargo.toml.
[]
= "0.1"
Usage
The Money struct is the primary interface, with the Currency struct supporting it.
Currency contains constants for all current ISO 4217 currencies.
use ;
// Create money from major or minor units
let subtotal = from_major;
let tax = from_minor;
// Arithmetic is available as either checked or panicking operations
let _unchecked = subtotal + tax;
let total = subtotal.checked_add.unwrap;
// The display format has sensible defaults...
assert_eq!;
// ...which can be overridden
let format = default.symbol;
assert_eq!;
Maintainer
This project is maintained by Rosa Richter. For ways to contact her, see her contact page.
Contributing
Questions and contributions are absolutely welcome! Please create an issue for bugs, feature requests, or questions.
License
BSD-2-Clause-Patent © Rosa Richter