lucre 0.4.0

An ergonomic library for handling money.
Documentation
# 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.

[ISO 4217]: https://en.wikipedia.org/wiki/ISO_4217

## Install

Add `lucre` to your `Cargo.toml`.

```toml
[dependencies]
lucre = "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.

```rust
use lucre::{Money, Currency, Format};

// Create money from major or minor units
let subtotal = Money::from_major(100, &Currency::USD);
let tax = Money::from_minor(475, &Currency::USD);

// Arithmetic is available as either checked or panicking operations
let _unchecked = subtotal + tax;
let total = subtotal.checked_add(&tax).unwrap();

// The display format has sensible defaults...
assert_eq!(total.to_string(), "104.75 USD");

// ...which can be overridden
let format = Format::default().symbol();
assert_eq!(total.format_with(&format).to_string(), "$104.75");
```

## Maintainer

This project is maintained by [Rosa Richter](https://cosmicrose.dev).
For ways to contact her, see her [contact page](https://cosmicrose.dev/contact/).

## Contributing

Questions and contributions are absolutely welcome!
Please [create an issue](https://code.cosmicrose.dev/rosa/lucre/issues/new)
for bugs, feature requests, or questions.

## License

[BSD-2-Clause-Patent](LICENSE) © Rosa Richter