fixed_unsigned/
types.rs

1use crate::{FixedUnsigned, FixedScale};
2
3
4
5/*macro_rules! create_typed_array {
6    ($scale: expr) => {
7        pub struct FixedScale$scale {}
8        impl ::fixed_unsigned::FixedScale for FixedScale$scale {
9            const SCALE: u64 = $scale;
10        }
11        pub type FixedUnsigned$scale = FixedUnsigned<FixedScale$scale>;
12    };
13}*/
14
15
16/// A fixed point Uint with 4 decimal places
17#[derive(Clone, Debug)]
18pub struct FixedScale4 {}
19impl FixedScale for FixedScale4 {
20    const SCALE: u64 = 4;
21}
22pub type FixedUnsigned4 = FixedUnsigned<FixedScale4>;
23
24
25/// A fixed point Uint with 8 decimal places
26#[derive(Clone, Debug)]
27pub struct FixedScale8 {}
28impl FixedScale for FixedScale8 {
29    const SCALE: u64 = 8;
30}
31pub type FixedUnsigned8 = FixedUnsigned<FixedScale8>;
32
33
34/// A fixed point Uint with 16 decimal places
35#[derive(Clone, Debug)]
36pub struct FixedScale16 {}
37impl FixedScale for FixedScale16 {
38    const SCALE: u64 = 16;
39}
40pub type FixedUnsigned16 = FixedUnsigned<FixedScale16>;
41
42
43/// A fixed point Uint with 10 decimal places
44///
45/// NOTE: This should have the same behaviour as bignumber.js (default config with 10 decimal places)
46#[derive(Clone, Debug)]
47pub struct FixedScale10 {}
48impl FixedScale for FixedScale10 {
49    const SCALE: u64 = 10;
50}
51pub type FixedUnsigned10 = FixedUnsigned<FixedScale10>;
52
53
54/// A fixed point Uint with 10 decimal places
55///
56/// NOTE: This should have the same behaviour as bignumber.js (default config with 10 decimal places)
57#[derive(Clone, Debug)]
58pub struct FixedScale26 {}
59impl FixedScale for FixedScale26 {
60    const SCALE: u64 = 26;
61}
62pub type FixedUnsigned26 = FixedUnsigned<FixedScale26>;