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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use crate::{FixedUnsigned, FixedScale};



/*macro_rules! create_typed_array {
    ($scale: expr) => {
        pub struct FixedScale$scale {}
        impl ::fixed_unsigned::FixedScale for FixedScale$scale {
            const SCALE: u64 = $scale;
        }
        pub type FixedUnsigned$scale = FixedUnsigned<FixedScale$scale>;
    };
}*/


/// A fixed point Uint with 4 decimal places
#[derive(Clone, Debug)]
pub struct FixedScale4 {}
impl FixedScale for FixedScale4 {
    const SCALE: u64 = 4;
}
pub type FixedUnsigned4 = FixedUnsigned<FixedScale4>;


/// A fixed point Uint with 8 decimal places
#[derive(Clone, Debug)]
pub struct FixedScale8 {}
impl FixedScale for FixedScale8 {
    const SCALE: u64 = 8;
}
pub type FixedUnsigned8 = FixedUnsigned<FixedScale8>;


/// A fixed point Uint with 16 decimal places
#[derive(Clone, Debug)]
pub struct FixedScale16 {}
impl FixedScale for FixedScale16 {
    const SCALE: u64 = 16;
}
pub type FixedUnsigned16 = FixedUnsigned<FixedScale16>;


/// A fixed point Uint with 10 decimal places
///
/// NOTE: This should have the same behaviour as bignumber.js (default config with 10 decimal places)
#[derive(Clone, Debug)]
pub struct FixedScale10 {}
impl FixedScale for FixedScale10 {
    const SCALE: u64 = 10;
}
pub type FixedUnsigned10 = FixedUnsigned<FixedScale10>;


/// A fixed point Uint with 10 decimal places
///
/// NOTE: This should have the same behaviour as bignumber.js (default config with 10 decimal places)
#[derive(Clone, Debug)]
pub struct FixedScale26 {}
impl FixedScale for FixedScale26 {
    const SCALE: u64 = 26;
}
pub type FixedUnsigned26 = FixedUnsigned<FixedScale26>;