Struct asyncio::ip::PrefixIpAddrV4 [] [src]

pub struct PrefixIpAddrV4 { /* fields omitted */ }

Implements Prefix IP version 4 style addresses.

Methods

impl PrefixIpAddrV4
[src]

Returns new PrefixIpAddrV4.

Examples

use asyncio::ip::{IpAddrV4, PrefixIpAddrV4};

assert!(PrefixIpAddrV4::new(IpAddrV4::new(192,168,100,1),
                            IpAddrV4::new(255,255,255,0)).is_some());

assert!(PrefixIpAddrV4::new(IpAddrV4::new(192,168,100,1),
                            IpAddrV4::new(0,0,0,255)).is_none());

Returns new PrefixIpAddrV4.

Panics

Panics if len == 0 or len > 32

use asyncio::ip::{IpAddrV4, PrefixIpAddrV4};

PrefixIpAddrV4::from(IpAddrV4::any(), 0);  // panic!

Returns a network address.

Examples

use asyncio::ip::{IpAddrV4, PrefixIpAddrV4};

let lo = PrefixIpAddrV4::from(IpAddrV4::loopback(), 8);
assert_eq!(lo.network(), IpAddrV4::new(127,0,0,0));

Returns a subnet mask.

Examples

use asyncio::ip::{IpAddrV4, PrefixIpAddrV4};

let lo = PrefixIpAddrV4::from(IpAddrV4::loopback(), 8);
assert_eq!(lo.netmask(), IpAddrV4::new(255,0,0,0));

Returns a length of subnet mask.

Trait Implementations

impl Display for PrefixIpAddrV4
[src]

Formats the value using the given formatter.

impl Debug for PrefixIpAddrV4
[src]

Formats the value using the given formatter.