icydb_schema/node/
list.rs1use crate::prelude::*;
2
3#[derive(Clone, Debug, Serialize)]
11pub struct List {
12 def: Def,
13 item: Item,
14 ty: Type,
15}
16
17impl List {
18 #[must_use]
20 pub const fn new(def: Def, item: Item, ty: Type) -> Self {
21 Self { def, item, ty }
22 }
23
24 #[must_use]
26 pub const fn def(&self) -> &Def {
27 &self.def
28 }
29
30 #[must_use]
32 pub const fn item(&self) -> &Item {
33 &self.item
34 }
35
36 #[must_use]
38 pub const fn ty(&self) -> &Type {
39 &self.ty
40 }
41}
42
43impl MacroNode for List {
44 fn as_any(&self) -> &dyn std::any::Any {
45 self
46 }
47}
48
49impl TypeNode for List {
50 fn ty(&self) -> &Type {
51 self.ty()
52 }
53}
54
55impl ValidateNode for List {}
56
57impl VisitableNode for List {
58 fn route_key(&self) -> String {
59 self.def().path()
60 }
61
62 fn drive<V: Visitor>(&self, v: &mut V) {
63 self.def().accept(v);
64 self.item().accept(v);
65 self.ty().accept(v);
66 }
67}