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