Struct asyncio::ip::IpAddrV6
[−]
[src]
pub struct IpAddrV6 { /* fields omitted */ }Implements IP version 6 style addresses.
Methods
impl IpAddrV6[src]
fn new(a: u16,
b: u16,
c: u16,
d: u16,
e: u16,
f: u16,
g: u16,
h: u16)
-> IpAddrV6
b: u16,
c: u16,
d: u16,
e: u16,
f: u16,
g: u16,
h: u16)
-> IpAddrV6
Returns a IP-v6 address.
The result will represent the IP address a:b:c:d:e:f:g:h
Examples
use asyncio::ip::IpAddrV6; let ip = IpAddrV6::new(0,0,0,0,0,0,0,1);
fn with_scope_id(a: u16,
b: u16,
c: u16,
d: u16,
e: u16,
f: u16,
g: u16,
h: u16,
scope_id: u32)
-> IpAddrV6
b: u16,
c: u16,
d: u16,
e: u16,
f: u16,
g: u16,
h: u16,
scope_id: u32)
-> IpAddrV6
Returns a IP-v6 address with set a scope-id.
The result will represent the IP address a:b:c:d:e:f:g:h%[scope-id]
Examples
use asyncio::ip::IpAddrV6; let ip = IpAddrV6::with_scope_id(0,0,0,0,0,0,0,1,0x01);
fn any() -> IpAddrV6
Returns a unspecified IP-v6 address.
Examples
use asyncio::ip::IpAddrV6; let ip = IpAddrV6::any(); assert_eq!(ip, IpAddrV6::new(0,0,0,0,0,0,0,0));
fn loopback() -> IpAddrV6
Returns a loopback IP-v6 address.
Examples
use asyncio::ip::IpAddrV6; let ip = IpAddrV6::loopback(); assert_eq!(ip, IpAddrV6::new(0,0,0,0,0,0,0,1));
fn from(bytes: [u8; 16], scope_id: u32) -> IpAddrV6
Returns a IP-v6 address from 16-octet bytes.
Examples
use asyncio::ip::IpAddrV6; let ip = IpAddrV6::from([0,1,2,3, 4,5,6,7, 8,9,10,11, 12,13,14,15], 0); assert_eq!(ip, IpAddrV6::new(0x0001, 0x0203,0x0405,0x0607,0x0809,0x0A0B, 0x0C0D, 0x0E0F));
fn get_scope_id(&self) -> u32
Returns a scope-id.
Examples
use asyncio::ip::IpAddrV6; let ip = IpAddrV6::with_scope_id(0,0,0,0,0,0,0,0, 10); assert_eq!(ip.get_scope_id(), 10);
fn set_scope_id(&mut self, scope_id: u32)
Sets a scope-id.
Examples
use asyncio::ip::IpAddrV6; let mut ip = IpAddrV6::loopback(); assert_eq!(ip.get_scope_id(), 0); ip.set_scope_id(0x10); assert_eq!(ip.get_scope_id(), 16);
fn is_unspecified(&self) -> bool
Returns true if this is a unspecified address.
fn is_loopback(&self) -> bool
Returns true if this is a loopback address.
fn is_link_local(&self) -> bool
Returns true if this is a link-local address.
fn is_site_local(&self) -> bool
Returns true if this is a site-local address.
fn is_multicast(&self) -> bool
Returns true if this is a some multicast address.
fn is_multicast_global(&self) -> bool
Returns true if this is a multicast address for global.
fn is_multicast_link_local(&self) -> bool
Returns true if this is a multicast address for link-local.
fn is_multicast_node_local(&self) -> bool
Returns true if this is a multicast address for node-local.
fn is_multicast_org_local(&self) -> bool
Returns true if this is a multicast address for org-local.
fn is_multicast_site_local(&self) -> bool
Returns true if this is a multicast address for site-local.
fn is_v4_mapped(&self) -> bool
Returns true if this is a mapped IP-v4 address.
fn is_v4_compatible(&self) -> bool
Returns true if this is a IP-v4 compatible address.
fn as_bytes(&self) -> &[u8; 16]
Retruns a 16 octets array.
fn to_v4(&self) -> Option<IpAddrV4>
Retruns a IP-v4 address if this is a convertable address.
fn v4_mapped(addr: &IpAddrV4) -> Self
Returns a mapped IP-v4 address.
Ex. 192.168.0.1 => ::ffff:192.168.0.1
fn v4_compatible(addr: &IpAddrV4) -> Option<Self>
Returns a IP-v4 compatible address if the addr isn't in 0.0.0.0, 0.0.0.1.
Ex. 192.168.0.1 => ::192.168.0.1
Trait Implementations
impl Default for IpAddrV6[src]
impl Clone for IpAddrV6[src]
fn clone(&self) -> IpAddrV6
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl Eq for IpAddrV6[src]
impl PartialEq for IpAddrV6[src]
fn eq(&self, __arg_0: &IpAddrV6) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &IpAddrV6) -> bool
This method tests for !=.
impl Ord for IpAddrV6[src]
fn cmp(&self, __arg_0: &IpAddrV6) -> Ordering
This method returns an Ordering between self and other. Read more
impl PartialOrd for IpAddrV6[src]
fn partial_cmp(&self, __arg_0: &IpAddrV6) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, __arg_0: &IpAddrV6) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, __arg_0: &IpAddrV6) -> bool
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, __arg_0: &IpAddrV6) -> bool
This method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, __arg_0: &IpAddrV6) -> bool
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl Hash for IpAddrV6[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher1.3.0
Feeds a slice of this type into the state provided.
impl AddAssign<i64> for IpAddrV6[src]
fn add_assign(&mut self, rhs: i64)
The method for the += operator
impl SubAssign<i64> for IpAddrV6[src]
fn sub_assign(&mut self, rhs: i64)
The method for the -= operator