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
mod handle_map;
mod tx_big_float;
mod tx_big_int;
mod tx_managed_buffer;
mod tx_managed_map;

pub use handle_map::HandleMap;
use num_bigint::BigInt;
pub use tx_big_int::big_int_to_i64;

use std::collections::HashMap;

pub(crate) type ManagedBufferImpl = Vec<u8>;
pub(crate) type ManagedMapImpl = HashMap<Vec<u8>, Vec<u8>>;

#[derive(Debug)]
pub struct TxManagedTypes {
    pub(crate) big_int_map: HandleMap<BigInt>,
    pub(crate) big_float_map: HandleMap<f64>,
    pub(crate) managed_buffer_map: HandleMap<ManagedBufferImpl>,
    pub(crate) managed_map_map: HandleMap<ManagedMapImpl>,
}

impl TxManagedTypes {
    pub fn new() -> Self {
        TxManagedTypes {
            big_int_map: HandleMap::new(),
            big_float_map: HandleMap::new(),
            managed_buffer_map: HandleMap::new(),
            managed_map_map: HandleMap::new(),
        }
    }
}

impl Default for TxManagedTypes {
    fn default() -> Self {
        TxManagedTypes::new()
    }
}