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

#![allow(
    dead_code,
    unused_imports,
    unused_variables,
    unused_macros,
    unused_assignments,
    unused_mut,
    non_snake_case,
    unused_must_use,
)]


use std::collections::HashMap;


use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result;


// use crate::Int;
// use crate::Float;
// use crate::SString;
// use crate::Char;
use crate::Object;
// use crate::_Object;



// TODO implement hash trait for object
pub struct Dict {
    _dict: HashMap<Object, Object>
}

impl Dict {
    pub fn new() -> Dict {
        Dict {
            _dict: HashMap::new()
        }
    }

    // fn set(&mut self, key: Object, value: Object) {
    //     self._dict.insert(key, value)
    // }
}

impl Display for Dict {
    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
        for (key, value) in self._dict.iter() {
            write!(f, "{}: {}", key, value);
        }
        write!(f, "\n")
    }
}