schematic 0.19.7

A layered serde configuration and schema library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::{ValidateResult, map_err};
pub use garde::rules::ip::{Ip, IpKind};

/// Validate a string is either an IP v4 or v6 address.
pub fn ip<T: Ip, D, C>(value: &T, _data: &D, _context: &C, _finalize: bool) -> ValidateResult {
    garde::rules::ip::apply(value, (IpKind::Any,)).map_err(map_err)
}

/// Validate a string is either an IP v4 address.
pub fn ip_v4<T: Ip, D, C>(value: &T, _data: &D, _context: &C, _finalize: bool) -> ValidateResult {
    garde::rules::ip::apply(value, (IpKind::V4,)).map_err(map_err)
}

/// Validate a string is either an IP v6 address.
pub fn ip_v6<T: Ip, D, C>(value: &T, _data: &D, _context: &C, _finalize: bool) -> ValidateResult {
    garde::rules::ip::apply(value, (IpKind::V6,)).map_err(map_err)
}