Enum netaddr::addr::IpAddrExperimental
[-]
[+]
[src]
pub enum IpAddr {
Ipv4Addr(IpAddr),
Ipv6Addr(IpAddr),
}Describe an IP address
Variants
Ipv4Addr | |
Ipv6Addr |
Methods
impl IpAddr
fn version(&self) -> IpAddrVersion
Get the corresponding IP address version.
fn max_prefixlen(&self) -> usize
The total number of bits in the address representation for this version: 32 for IPv4, 128 for IPv6.
The prefix defines the number of leading bits in an address that are compared to determine whether or not an address is part of a network.
fn with_prefixlen(version: IpAddrVersion, n: usize) -> Option<IpAddr>
Create an IP mask with the specified prefixlen.
The provided prefixlen must be in the prefixlen-range corresponding to the IP version.
fn packed(&self) -> Vec<u8>
The binary representation of this address - a bytes vector of the appropriate length (most significant octet first). This is 4 bytes for IPv4 and 16 bytes for IPv6.
impl IpAddr
Convert operations from/to Rust's standard library IP addresses.
fn from_std(ip: StdIpAddr) -> IpAddr
Create an IpAddr instance from a Rust's standard library IpAddr instance.
fn to_std(&self) -> StdIpAddr
Create a Rust's standard library IpAddr instance from an IpAddr instance.
fn into_std(self) -> StdIpAddr
Convert an IpAddr instance into a Rust's standard library IpAddr instance.