use crate::prelude::*;
#[derive(Clone, Debug, Serialize)]
pub struct Map {
def: Def,
key: Item,
value: Value,
ty: Type,
}
impl Map {
#[must_use]
pub const fn new(def: Def, key: Item, value: Value, ty: Type) -> Self {
Self {
def,
key,
value,
ty,
}
}
#[must_use]
pub const fn def(&self) -> &Def {
&self.def
}
#[must_use]
pub const fn key(&self) -> &Item {
&self.key
}
#[must_use]
pub const fn value(&self) -> &Value {
&self.value
}
#[must_use]
pub const fn ty(&self) -> &Type {
&self.ty
}
}
impl MacroNode for Map {
fn as_any(&self) -> &dyn std::any::Any {
self
}
}
impl TypeNode for Map {
fn ty(&self) -> &Type {
self.ty()
}
}
impl ValidateNode for Map {}
impl VisitableNode for Map {
fn route_key(&self) -> String {
self.def().path()
}
fn drive<V: Visitor>(&self, v: &mut V) {
self.def().accept(v);
self.key().accept(v);
self.value().accept(v);
self.ty().accept(v);
}
}