schematic/validate/
number.rs

1use super::{Validator, map_err};
2pub use garde::rules::range::Bounds;
3use std::fmt::Display;
4
5/// Validate a numeric value is between the provided bounds (non-inclusive).
6pub fn in_range<T: Bounds + Display + 'static, D, C>(
7    min: T::Size,
8    max: T::Size,
9) -> Validator<T, D, C> {
10    Box::new(move |value, _, _, _| {
11        garde::rules::range::apply(value, (Some(min), Some(max))).map_err(map_err)
12    })
13}