hydrate_schema/schema/map.rs
1use super::Schema;
2
3#[derive(Clone, Debug, PartialEq)]
4pub struct SchemaMap {
5 key_type: Box<Schema>,
6 value_type: Box<Schema>,
7}
8
9impl SchemaMap {
10 pub fn new(
11 key_type: Box<Schema>,
12 value_type: Box<Schema>,
13 ) -> Self {
14 //TODO: Check key_type is not an undesirable type (i.e. must be hashable)
15 SchemaMap {
16 key_type,
17 value_type,
18 }
19 }
20
21 pub fn key_type(&self) -> &Schema {
22 &*self.key_type
23 }
24
25 pub fn value_type(&self) -> &Schema {
26 &*self.value_type
27 }
28}