use super::DataType;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Map(Box<(DataType, DataType)>);
impl Map {
pub fn new(key_ty: DataType, value_ty: DataType) -> Self {
Self(Box::new((key_ty, value_ty)))
}
pub fn key_ty(&self) -> &DataType {
&self.0.0
}
pub fn key_ty_mut(&mut self) -> &mut DataType {
&mut self.0.0
}
pub fn set_key_ty(&mut self, key_ty: DataType) {
self.0.0 = key_ty;
}
pub fn value_ty(&self) -> &DataType {
&self.0.1
}
pub fn value_ty_mut(&mut self) -> &mut DataType {
&mut self.0.1
}
pub fn set_value_ty(&mut self, value_ty: DataType) {
self.0.1 = value_ty;
}
}
impl From<Map> for DataType {
fn from(t: Map) -> Self {
Self::Map(t)
}
}