Enum IpAddress
pub enum IpAddress {
Ipv4(Ipv4Addr),
Ipv6(Ipv6Addr),
}
Expand description
An internetworking address.
Variants§
Ipv4(Ipv4Addr)
Available on crate feature
proto-ipv4
only.An IPv4 address.
Ipv6(Ipv6Addr)
Available on crate feature
proto-ipv6
only.An IPv6 address.
Implementations§
§impl Address
impl Address
pub const fn v4(a0: u8, a1: u8, a2: u8, a3: u8) -> Address
Available on crate features dns
and proto-ipv4
only.
pub const fn v4(a0: u8, a1: u8, a2: u8, a3: u8) -> Address
dns
and proto-ipv4
only.Create an address wrapping an IPv4 address with the given octets.
pub const fn v6(
a0: u16,
a1: u16,
a2: u16,
a3: u16,
a4: u16,
a5: u16,
a6: u16,
a7: u16,
) -> Address
Available on crate features dns
and proto-ipv6
only.
pub const fn v6( a0: u16, a1: u16, a2: u16, a3: u16, a4: u16, a5: u16, a6: u16, a7: u16, ) -> Address
dns
and proto-ipv6
only.Create an address wrapping an IPv6 address with the given octets.
pub const fn version(&self) -> Version
Available on crate feature dns
only.
pub const fn version(&self) -> Version
dns
only.Return the protocol version.
pub fn is_unicast(&self) -> bool
Available on crate feature dns
only.
pub fn is_unicast(&self) -> bool
dns
only.Query whether the address is a valid unicast address.
pub const fn is_multicast(&self) -> bool
Available on crate feature dns
only.
pub const fn is_multicast(&self) -> bool
dns
only.Query whether the address is a valid multicast address.
pub fn is_broadcast(&self) -> bool
Available on crate feature dns
only.
pub fn is_broadcast(&self) -> bool
dns
only.Query whether the address is the broadcast address.
pub fn is_unspecified(&self) -> bool
Available on crate feature dns
only.
pub fn is_unspecified(&self) -> bool
dns
only.Query whether the address falls into the “unspecified” range.
pub fn prefix_len(&self) -> Option<u8>
Available on crate feature dns
only.
pub fn prefix_len(&self) -> Option<u8>
dns
only.If self
is a CIDR-compatible subnet mask, return Some(prefix_len)
,
where prefix_len
is the number of leading zeroes. Return None
otherwise.
Trait Implementations§
§impl Ord for Address
impl Ord for Address
§impl PartialOrd for Address
impl PartialOrd for Address
impl Copy for Address
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
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
Mutably borrows from an owned value. Read more