Struct asyncio::ip::IpAddrV4 [] [src]

pub struct IpAddrV4 { /* fields omitted */ }

Implements IP version 4 style addresses.

Methods

impl IpAddrV4
[src]

Returns a IP-v4 address.

The result will represent the IP address a.b.c.d.

Examples

use asyncio::ip::IpAddrV4;

let ip = IpAddrV4::new(192,168,0,1);

Returns a unspecified IP-v4 address.

Examples

use asyncio::ip::IpAddrV4;

let ip = IpAddrV4::any();
assert_eq!(ip, IpAddrV4::new(0,0,0,0));

Returns a IP-v4 address for a loopback address.

Examples

use asyncio::ip::IpAddrV4;

let ip = IpAddrV4::loopback();
assert_eq!(ip, IpAddrV4::new(127,0,0,1));

Returns true for if this is a unspecified address 0.0.0.0.

Examples

use asyncio::ip::IpAddrV4;

assert!(IpAddrV4::any().is_unspecified());

Return true for if this is a loopback address 127.0.0.1.

Examples

use asyncio::ip::IpAddrV4;

assert!(IpAddrV4::loopback().is_loopback());

Returns true for if this is a class A address.

The class A address ranges:

  • 10.0.0.0/8

Examples

use asyncio::ip::IpAddrV4;

assert!(IpAddrV4::new(10,0,0,1).is_class_a());

Returns true for if this is a class B address.

The class B address ranges:

  • 172.16.0.0/12

Examples

use asyncio::ip::IpAddrV4;

assert!(IpAddrV4::new(172,16,0,1).is_class_b());

Returns true for if this is a class C address.

The class c address ranges:

  • 192.168.0.0/16

Examples

use asyncio::ip::IpAddrV4;

assert!(IpAddrV4::new(192,168,0,1).is_class_c());

Returns true for if this is a private address.

The private address ranges:

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16

Examples

use asyncio::ip::IpAddrV4;

assert!(IpAddrV4::new(192,168,0,1).is_private());

Returns true for if this is a class D address.

The class D address ranges:

  • 224.0.0.0/4

Examples

use asyncio::ip::IpAddrV4;

assert!(IpAddrV4::new(224,0,0,1).is_multicast());

Returns true for if this is a link-local address.

The link-local address ranges:

  • 169.254.0.0/16

Examples

use asyncio::ip::IpAddrV4;

assert!(IpAddrV4::new(169,254,0,0).is_link_local());

Returns 4 octets bytes.

Examples

use asyncio::ip::IpAddrV4;

assert_eq!(IpAddrV4::new(169,254,0,1).as_bytes(), &[169,254,0,1]);

Returns u32 in host byte order.

Examples

use asyncio::ip::IpAddrV4;

assert_eq!(IpAddrV4::new(10,0,0,1).to_u32(), 10*256*256*256+1);

Trait Implementations

impl Default for IpAddrV4
[src]

Returns the "default value" for a type. Read more

impl Clone for IpAddrV4
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Eq for IpAddrV4
[src]

impl PartialEq for IpAddrV4
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Ord for IpAddrV4
[src]

This method returns an Ordering between self and other. Read more

impl PartialOrd for IpAddrV4
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Hash for IpAddrV4
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

impl AddAssign<i64> for IpAddrV4
[src]

The method for the += operator

impl SubAssign<i64> for IpAddrV4
[src]

The method for the -= operator

impl Display for IpAddrV4
[src]

Formats the value using the given formatter.

impl Debug for IpAddrV4
[src]

Formats the value using the given formatter.

impl From<u32> for IpAddrV4
[src]

Performs the conversion.

impl From<[u8; 4]> for IpAddrV4
[src]

Performs the conversion.

impl<P: Protocol> IntoEndpoint<P> for IpAddrV4
[src]

impl<'a, P: Protocol> IntoEndpoint<P> for &'a IpAddrV4
[src]

impl FromStr for IpAddrV4
[src]

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more