Skip to main content

icydb_schema/node/
sanitizer.rs

1use crate::prelude::*;
2
3///
4/// Sanitizer
5///
6/// Schema node describing one named sanitizer definition and its shared
7/// definition metadata.
8///
9
10#[derive(Clone, Debug, Serialize)]
11pub struct Sanitizer {
12    def: Def,
13}
14
15impl Sanitizer {
16    /// Creates a sanitizer node from definition metadata.
17    #[must_use]
18    pub const fn new(def: Def) -> Self {
19        Self { def }
20    }
21
22    /// Returns the sanitizer definition metadata.
23    #[must_use]
24    pub const fn def(&self) -> &Def {
25        &self.def
26    }
27}
28
29impl MacroNode for Sanitizer {
30    fn as_any(&self) -> &dyn std::any::Any {
31        self
32    }
33}
34
35impl ValidateNode for Sanitizer {}
36
37impl VisitableNode for Sanitizer {
38    fn route_key(&self) -> String {
39        self.def().path()
40    }
41
42    fn drive<V: Visitor>(&self, v: &mut V) {
43        self.def().accept(v);
44    }
45}