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.

Trait Implementations

impl Add<usize> for IpAddr

type Output = IpAddr

fn add(self, rhs: usize) -> IpAddr

impl Sub<usize> for IpAddr

type Output = IpAddr

fn sub(self, rhs: usize) -> IpAddr

impl BitXor<IpAddr> for IpAddr

type Output = Option<IpAddr>

fn bitxor(self, rhs: IpAddr) -> Option<IpAddr>

impl BitOr<IpAddr> for IpAddr

type Output = Option<IpAddr>

fn bitor(self, rhs: IpAddr) -> Option<IpAddr>

impl BitAnd<IpAddr> for IpAddr

type Output = Option<IpAddr>

fn bitand(self, rhs: IpAddr) -> Option<IpAddr>

impl Not for IpAddr

type Output = IpAddr

fn not(self) -> IpAddr

impl String for IpAddr

fn fmt(&self, f: &mut Formatter) -> Result

impl FromStr for IpAddr

fn from_str(s: &str) -> Option<IpAddr>

Derived Implementations

impl Decodable for IpAddr

fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<IpAddr, Error>

impl Encodable for IpAddr

fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), Error>

impl<__S: Writer + Hasher> Hash<__S> for IpAddr

fn hash(&self, __arg_0: &mut __S)

impl Ord for IpAddr

fn cmp(&self, __arg_0: &IpAddr) -> Ordering

impl PartialOrd for IpAddr

fn partial_cmp(&self, __arg_0: &IpAddr) -> Option<Ordering>

fn lt(&self, __arg_0: &IpAddr) -> bool

fn le(&self, __arg_0: &IpAddr) -> bool

fn gt(&self, __arg_0: &IpAddr) -> bool

fn ge(&self, __arg_0: &IpAddr) -> bool

impl Eq for IpAddr

fn assert_receiver_is_total_eq(&self)

impl PartialEq for IpAddr

fn eq(&self, __arg_0: &IpAddr) -> bool

fn ne(&self, __arg_0: &IpAddr) -> bool

impl Show for IpAddr

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Clone for IpAddr

fn clone(&self) -> IpAddr

fn clone_from(&mut self, source: &Self)

impl Copy for IpAddr