lucre 0.13.0

An ergonomic library for handling money.
Documentation
#![doc = include_str!("../README.md")]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(missing_docs, missing_debug_implementations)]

#[doc(no_inline)]
pub use rust_decimal::Decimal;
#[doc(no_inline)]
pub use vec1::{Vec1, vec1};

mod bag;
mod currency;
mod exchange;
mod format;
mod money;
mod parse;
#[cfg(feature = "serde")]
mod serde;

pub use bag::{Balances, Currencies, IntoBalances, MoneyBag, MoneyBagError};
pub use currency::{
    Currency, CurrencyError, IsoAlphabeticCode, IsoAlphabeticCodeError, IsoNumericCode,
    IsoNumericCodeError, ParseCurrencyError,
};
pub use exchange::{
    ConvertError, CrossRateError, Exchange, ExchangeError, ExchangeRate, ExchangeRateError,
    IntoRates, InvertError, Pair, Pairs, ParsePairError, Rates, Side,
};
pub use format::Format;
pub use money::{Money, MoneyError};
pub use parse::{ParseMoneyError, Parser};

/// What to do with a value that falls exactly halfway when rounding.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[non_exhaustive]
pub enum RoundingMode {
    /// Move it away from zero: `0.125` becomes `0.13`, and `-0.125` becomes
    /// `-0.13`.
    HalfUp,

    /// Move it toward zero: `0.125` becomes `0.12`, and `-0.125` becomes
    /// `-0.12`.
    HalfDown,

    /// Move it to whichever neighbor ends in an even digit: `0.125` becomes
    /// `0.12`, and `0.135` becomes `0.14`. Across many values this leaves the
    /// total where it was, while the other two rules push it steadily away
    /// from zero.
    HalfEven,
}