icydb_model/base/normalizer/text/mod.rs
1//! Module: base::normalizer::text
2//!
3//! Responsibility: base normalizer definitions.
4//! Does not own: validation policy, persistence, or schema mutation semantics.
5//! Boundary: mutates schema field values through facade normalizer traits.
6
7pub mod ascii;
8pub mod case;
9pub mod color;
10
11use crate::{prelude::*, visitor::Normalizer};
12
13///
14/// Trim
15///
16
17#[normalizer]
18pub struct Trim;
19
20impl Normalizer<String> for Trim {
21 fn normalize(&self, value: &mut String) -> Result<(), String> {
22 let trimmed = value.trim();
23
24 if trimmed.len() != value.len() {
25 *value = trimmed.to_owned();
26 }
27
28 Ok(())
29 }
30}