pub trait IpAddrWitness: Witness<IpAddr> + Into<IpAddr<Self::V4, Self::V6>> + Copy {
    type V4: Witness<Ipv4Addr> + Into<Self> + Copy;
    type V6: Witness<Ipv6Addr> + Into<Self> + Copy;

    // Provided methods
    fn from_v4(addr: Self::V4) -> Self { ... }
    fn from_v6(addr: Self::V6) -> Self { ... }
Expand description

A type which is a witness to some property about an IpAddress.

IpAddrWitness extends Witness of IpAddr by adding associated types for the IPv4- and IPv6-specific versions of the same witness type. For example, the following implementation is provided for SpecifiedAddr<IpAddr>:

impl IpAddrWitness for SpecifiedAddr<IpAddr> {
    type V4 = SpecifiedAddr<Ipv4Addr>;
    type V6 = SpecifiedAddr<Ipv6Addr>;

Required Associated Types§


type V4: Witness<Ipv4Addr> + Into<Self> + Copy

The IPv4-specific version of Self.

For example, SpecifiedAddr<IpAddr>: IpAddrWitness<V4 = SpecifiedAddr<Ipv4Addr>>.


type V6: Witness<Ipv6Addr> + Into<Self> + Copy

The IPv6-specific version of Self.

For example, SpecifiedAddr<IpAddr>: IpAddrWitness<V6 = SpecifiedAddr<Ipv6Addr>>.

Provided Methods§


fn from_v4(addr: Self::V4) -> Self

Converts an IPv4-specific witness into a general witness.


fn from_v6(addr: Self::V6) -> Self

Converts an IPv6-specific witness into a general witness.

Object Safety§

This trait is not object safe.