pub enum IpAddr<V4 = Ipv4Addr, V6 = Ipv6Addr> {
V4(V4),
V6(V6),
}
Expand description
An IP address.
By default, the contained address types are Ipv4Addr
and Ipv6Addr
.
However, any types can be provided. This is intended to support types like
IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
. From
is
implemented to support conversions in both directions between
IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
and
SpecifiedAddr<IpAddr>
, and similarly for other witness types.
Variants§
Implementations§
Source§impl<V4, V6> IpAddr<V4, V6>
impl<V4, V6> IpAddr<V4, V6>
Sourcepub fn transpose<W: IpAddrWitness<V4 = V4, V6 = V6>>(self) -> W
pub fn transpose<W: IpAddrWitness<V4 = V4, V6 = V6>>(self) -> W
Transposes an IpAddr
of a witness type to a witness type of an
IpAddr
.
For example, transpose
can be used to convert an
IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
into a
SpecifiedAddr<IpAddr<Ipv4Addr, Ipv6Addr>>
.
Trait Implementations§
Source§impl From<IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>> for LinkLocalAddr<IpAddr>
impl From<IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>> for LinkLocalAddr<IpAddr>
Source§fn from(
addr: IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>,
) -> LinkLocalAddr<IpAddr>
fn from( addr: IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>, ) -> LinkLocalAddr<IpAddr>
Source§impl From<IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>> for MulticastAddr<IpAddr>
impl From<IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>> for MulticastAddr<IpAddr>
Source§fn from(
addr: IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>,
) -> MulticastAddr<IpAddr>
fn from( addr: IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>, ) -> MulticastAddr<IpAddr>
Source§impl From<IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>> for NonMappedAddr<IpAddr>
impl From<IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>> for NonMappedAddr<IpAddr>
Source§fn from(
addr: IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>,
) -> NonMappedAddr<IpAddr>
fn from( addr: IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>, ) -> NonMappedAddr<IpAddr>
Source§impl From<IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>> for SpecifiedAddr<IpAddr>
impl From<IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>> for SpecifiedAddr<IpAddr>
Source§fn from(
addr: IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>,
) -> SpecifiedAddr<IpAddr>
fn from( addr: IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>, ) -> SpecifiedAddr<IpAddr>
Source§impl<A: IpAddress> From<LinkLocalAddr<A>> for IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>
impl<A: IpAddress> From<LinkLocalAddr<A>> for IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>
Source§fn from(
addr: LinkLocalAddr<A>,
) -> IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>
fn from( addr: LinkLocalAddr<A>, ) -> IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>
Source§impl From<LinkLocalAddr<IpAddr>> for IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>
impl From<LinkLocalAddr<IpAddr>> for IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>
Source§fn from(
addr: LinkLocalAddr<IpAddr>,
) -> IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>
fn from( addr: LinkLocalAddr<IpAddr>, ) -> IpAddr<LinkLocalAddr<Ipv4Addr>, LinkLocalAddr<Ipv6Addr>>
Source§impl<A: IpAddress> From<MulticastAddr<A>> for IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
impl<A: IpAddress> From<MulticastAddr<A>> for IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
Source§fn from(
addr: MulticastAddr<A>,
) -> IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
fn from( addr: MulticastAddr<A>, ) -> IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
Source§impl From<MulticastAddr<IpAddr>> for IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
impl From<MulticastAddr<IpAddr>> for IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
Source§fn from(
addr: MulticastAddr<IpAddr>,
) -> IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
fn from( addr: MulticastAddr<IpAddr>, ) -> IpAddr<MulticastAddr<Ipv4Addr>, MulticastAddr<Ipv6Addr>>
Source§impl<A: IpAddress> From<NonMappedAddr<A>> for IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>
impl<A: IpAddress> From<NonMappedAddr<A>> for IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>
Source§fn from(
addr: NonMappedAddr<A>,
) -> IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>
fn from( addr: NonMappedAddr<A>, ) -> IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>
Source§impl From<NonMappedAddr<IpAddr>> for IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>
impl From<NonMappedAddr<IpAddr>> for IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>
Source§fn from(
addr: NonMappedAddr<IpAddr>,
) -> IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>
fn from( addr: NonMappedAddr<IpAddr>, ) -> IpAddr<NonMappedAddr<Ipv4Addr>, NonMappedAddr<Ipv6Addr>>
Source§impl<A: IpAddress> From<SpecifiedAddr<A>> for IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
impl<A: IpAddress> From<SpecifiedAddr<A>> for IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
Source§fn from(
addr: SpecifiedAddr<A>,
) -> IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
fn from( addr: SpecifiedAddr<A>, ) -> IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
Source§impl From<SpecifiedAddr<IpAddr>> for IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
impl From<SpecifiedAddr<IpAddr>> for IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
Source§fn from(
addr: SpecifiedAddr<IpAddr>,
) -> IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
fn from( addr: SpecifiedAddr<IpAddr>, ) -> IpAddr<SpecifiedAddr<Ipv4Addr>, SpecifiedAddr<Ipv6Addr>>
Source§impl LinkLocalAddress for IpAddr
impl LinkLocalAddress for IpAddr
Source§fn is_link_local(&self) -> bool
fn is_link_local(&self) -> bool
Is this address link-local?
Source§impl MappedAddress for IpAddr
impl MappedAddress for IpAddr
Source§fn is_non_mapped(&self) -> bool
fn is_non_mapped(&self) -> bool
Is this address non-mapped?
Source§impl MulticastAddress for IpAddr
impl MulticastAddress for IpAddr
Source§fn is_multicast(&self) -> bool
fn is_multicast(&self) -> bool
Is this an address in the multicast subnet?
is_multicast
returns true if self
is in Ip::MULTICAST_SUBNET
for
the IP version of this address.
Source§fn is_non_multicast(&self) -> bool
fn is_non_multicast(&self) -> bool
is_multicast()
.Source§impl<V4: Ord, V6: Ord> Ord for IpAddr<V4, V6>
impl<V4: Ord, V6: Ord> Ord for IpAddr<V4, V6>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<V4: PartialOrd, V6: PartialOrd> PartialOrd for IpAddr<V4, V6>
impl<V4: PartialOrd, V6: PartialOrd> PartialOrd for IpAddr<V4, V6>
Source§impl Scope for IpAddr<(), Ipv6Scope>
impl Scope for IpAddr<(), Ipv6Scope>
Source§fn can_have_zone(&self) -> bool
fn can_have_zone(&self) -> bool
Source§impl ScopeableAddress for IpAddr
impl ScopeableAddress for IpAddr
Source§impl SpecifiedAddress for IpAddr
impl SpecifiedAddress for IpAddr
Source§fn is_specified(&self) -> bool
fn is_specified(&self) -> bool
Is this an address other than the unspecified address?
is_specified
returns true if self
is not equal to
Ip::UNSPECIFIED_ADDRESS
for the IP version of this address.
impl<V4: Copy, V6: Copy> Copy for IpAddr<V4, V6>
impl<V4: Eq, V6: Eq> Eq for IpAddr<V4, V6>
impl<V4, V6> StructuralPartialEq for IpAddr<V4, V6>
Auto Trait Implementations§
impl<V4, V6> Freeze for IpAddr<V4, V6>
impl<V4, V6> RefUnwindSafe for IpAddr<V4, V6>where
V4: RefUnwindSafe,
V6: RefUnwindSafe,
impl<V4, V6> Send for IpAddr<V4, V6>
impl<V4, V6> Sync for IpAddr<V4, V6>
impl<V4, V6> Unpin for IpAddr<V4, V6>
impl<V4, V6> UnwindSafe for IpAddr<V4, V6>where
V4: UnwindSafe,
V6: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)