icydb_schema/node/
tuple.rs1use crate::prelude::*;
2
3#[derive(Clone, Debug, Serialize)]
8pub struct Tuple {
9 def: Def,
10 values: &'static [Value],
11 ty: Type,
12}
13
14impl Tuple {
15 #[must_use]
17 pub const fn new(def: Def, values: &'static [Value], ty: Type) -> Self {
18 Self { def, values, ty }
19 }
20
21 #[must_use]
23 pub const fn def(&self) -> &Def {
24 &self.def
25 }
26
27 #[must_use]
29 pub const fn values(&self) -> &'static [Value] {
30 self.values
31 }
32
33 #[must_use]
35 pub const fn ty(&self) -> &Type {
36 &self.ty
37 }
38}
39
40impl MacroNode for Tuple {
41 fn as_any(&self) -> &dyn std::any::Any {
42 self
43 }
44}
45
46impl ValidateNode for Tuple {}
47
48impl VisitableNode for Tuple {
49 fn route_key(&self) -> String {
50 self.def().path()
51 }
52
53 fn drive<V: Visitor>(&self, v: &mut V) {
54 self.def().accept(v);
55 for node in self.values() {
56 node.accept(v);
57 }
58 self.ty().accept(v);
59 }
60}