icydb-core 0.94.0

IcyDB — A schema-first typed query engine and persistence runtime for Internet Computer canisters
Documentation
//! Module: visitor::sanitize
//! Responsibility: sanitize visitor implementation over visitable trees.
//! Does not own: top-level sanitize entrypoints or issue aggregation policy.
//! Boundary: mutating visitor used by the crate-level sanitize surface.

use crate::{
    traits::Visitable,
    visitor::{VisitorContext, VisitorMut},
};

///
/// SanitizeVisitor
///
/// Walks a tree and applies sanitization at each node.
///

#[derive(Debug, Default)]
pub(crate) struct SanitizeVisitor;

impl SanitizeVisitor {
    #[must_use]
    pub(crate) const fn new() -> Self {
        Self
    }
}

impl VisitorMut for SanitizeVisitor {
    fn enter_mut(&mut self, node: &mut dyn Visitable, ctx: &mut dyn VisitorContext) {
        node.sanitize_self(ctx);
        node.sanitize_custom(ctx);
    }

    fn exit_mut(&mut self, _: &mut dyn Visitable, _: &mut dyn VisitorContext) {}
}