pub trait IntoIpRange {
// Required method
fn into_range(self) -> Option<RangeInclusive<IpAddr>>;
// Provided method
fn validate(
ip_range: RangeInclusive<IpAddr>,
) -> Option<RangeInclusive<IpAddr>> { ... }
}Expand description
Converts a type into an IP range accepted by
HttpAclBuilder::add_allowed_ip_range
and its denied/setter counterparts.
Implemented for IpNet, RangeInclusive<IpAddr>, and (IpAddr, IpAddr). Use
whichever is most convenient: a CIDR block, an inclusive range, or a plain tuple.
Required Methods§
Sourcefn into_range(self) -> Option<RangeInclusive<IpAddr>>
fn into_range(self) -> Option<RangeInclusive<IpAddr>>
Converts the type into an IP range, or None if it isn’t a valid one (see
Self::validate).
Provided Methods§
Sourcefn validate(ip_range: RangeInclusive<IpAddr>) -> Option<RangeInclusive<IpAddr>>
fn validate(ip_range: RangeInclusive<IpAddr>) -> Option<RangeInclusive<IpAddr>>
Validates the IP range.
Both ends must be the same IP address family. Without this check, a mixed-family
range like 1.0.0.0..=:: would be accepted (IpAddr’s Ord sorts all IPv4
addresses before all IPv6 addresses) and silently match every IPv4 address from
the start onward and every IPv6 address.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".