cashmoney 0.2.0

Library for safe monetary calculations
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Supported currencies, identified by their ISO 4217 code.
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Currency {
    // United States Dollar
    USD,
    // Canadian Dollar
    CAD,
}

impl Currency {
    pub fn max_precision(&self) -> u32 {
        match self {
            Currency::USD => 2,
            Currency::CAD => 2,
        }
    }
}