Struct netaddr::addr::ipv4::IpAddrExperimental
[-]
[+]
[src]
pub struct IpAddr(pub u8, pub u8, pub u8, pub u8);
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(n: usize) -> IpAddr
Create an IP mask with the specified prefixlen.
The provided prefixlen must be in the prefixlen-range (0
<= n
<= 32
).
fn packed(&self) -> [u8, ..4]
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.
fn from_u32(n: u32) -> IpAddr
Create an IpAddr
instance from a 32-bits integer.
fn to_u32(&self) -> u32
Convert an IpAddr
instance to a 32-bits integer.
impl IpAddr
Convert operations from/to Rust's standard library IP addresses.
fn from_std(ip: StdIpAddr) -> Option<IpAddr>
Create an ipv4::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 ipv4::IpAddr
instance.
fn into_std(self) -> StdIpAddr
Convert an ipv4::IpAddr
instance into a Rust's standard library IpAddr
instance.