Skip to main content

icydb_schema/node/
sanitizer.rs

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