1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
// Copyright 2016 John D. Hume // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. //! Currency and money values for Rust, plus customizable formatting of money values and reference //! data for real-world currencies. //! //! # Money and SmallMoney //! //! The crate provides two representations of an amount of money in a certain currency, both of //! which have similar implementations and feature similar behavior. They internally represent their //! amounts as an integer of the "minor" unit of their currency. For example a US-Dollar amount is //! stored as an integer number of cents. //! //! The starting point for most uses should probably be `Money`. The range of values it can //! represent should be large enough for almost all uses. //! //! `SmallMoney` is only 64 bits in size, which might be nice from a performance perspective, but //! the range of values it can represent is quite limited. See the doc tests of `min` and `max` //! for details. #[macro_use] extern crate lazy_static; pub mod currency; pub mod formatting; mod base26; mod money; mod small_money; pub use currency::Currency; pub use money::Money; pub use small_money::SmallMoney;