pub struct IpAddrV6 { /* private fields */ }
Expand description
Implements IP version 6 style addresses.
Implementations§
Source§impl IpAddrV6
impl IpAddrV6
Sourcepub fn new(
a: u16,
b: u16,
c: u16,
d: u16,
e: u16,
f: u16,
g: u16,
h: u16,
) -> IpAddrV6
pub fn new( a: u16, 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);
Sourcepub fn with_scope_id(
a: u16,
b: u16,
c: u16,
d: u16,
e: u16,
f: u16,
g: u16,
h: u16,
scope_id: u32,
) -> IpAddrV6
pub fn with_scope_id( a: u16, 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);
Sourcepub fn any() -> IpAddrV6
pub 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));
Sourcepub fn loopback() -> IpAddrV6
pub 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));
Sourcepub fn from(bytes: [u8; 16], scope_id: u32) -> IpAddrV6
pub 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));
Sourcepub fn get_scope_id(&self) -> u32
pub 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);
Sourcepub fn set_scope_id(&mut self, scope_id: u32)
pub 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);
Sourcepub fn is_unspecified(&self) -> bool
pub fn is_unspecified(&self) -> bool
Returns true if this is a unspecified address.
Sourcepub fn is_loopback(&self) -> bool
pub fn is_loopback(&self) -> bool
Returns true if this is a loopback address.
Sourcepub fn is_link_local(&self) -> bool
pub fn is_link_local(&self) -> bool
Returns true if this is a link-local address.
Sourcepub fn is_site_local(&self) -> bool
pub fn is_site_local(&self) -> bool
Returns true if this is a site-local address.
Sourcepub fn is_multicast(&self) -> bool
pub fn is_multicast(&self) -> bool
Returns true if this is a some multicast address.
Sourcepub fn is_multicast_global(&self) -> bool
pub fn is_multicast_global(&self) -> bool
Returns true if this is a multicast address for global.
Sourcepub fn is_multicast_link_local(&self) -> bool
pub fn is_multicast_link_local(&self) -> bool
Returns true if this is a multicast address for link-local.
Sourcepub fn is_multicast_node_local(&self) -> bool
pub fn is_multicast_node_local(&self) -> bool
Returns true if this is a multicast address for node-local.
Sourcepub fn is_multicast_org_local(&self) -> bool
pub fn is_multicast_org_local(&self) -> bool
Returns true if this is a multicast address for org-local.
Sourcepub fn is_multicast_site_local(&self) -> bool
pub fn is_multicast_site_local(&self) -> bool
Returns true if this is a multicast address for site-local.
Sourcepub fn is_v4_mapped(&self) -> bool
pub fn is_v4_mapped(&self) -> bool
Returns true if this is a mapped IP-v4 address.
Sourcepub fn is_v4_compatible(&self) -> bool
pub fn is_v4_compatible(&self) -> bool
Returns true if this is a IP-v4 compatible address.
Sourcepub fn to_v4(&self) -> Option<IpAddrV4>
pub fn to_v4(&self) -> Option<IpAddrV4>
Retruns a IP-v4 address if this is a convertable address.
Sourcepub fn v4_mapped(addr: &IpAddrV4) -> Self
pub fn v4_mapped(addr: &IpAddrV4) -> Self
Returns a mapped IP-v4 address.
Ex. 192.168.0.1 => ::ffff:192.168.0.1
Sourcepub fn v4_compatible(addr: &IpAddrV4) -> Option<Self>
pub 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§
Source§impl AddAssign<i64> for IpAddrV6
impl AddAssign<i64> for IpAddrV6
Source§fn add_assign(&mut self, rhs: i64)
fn add_assign(&mut self, rhs: i64)
+=
operation. Read moreSource§impl<'a, P: Protocol> IntoEndpoint<P> for &'a IpAddrV6
impl<'a, P: Protocol> IntoEndpoint<P> for &'a IpAddrV6
fn into_endpoint(self, port: u16) -> IpEndpoint<P>
Source§impl<P: Protocol> IntoEndpoint<P> for IpAddrV6
impl<P: Protocol> IntoEndpoint<P> for IpAddrV6
fn into_endpoint(self, port: u16) -> IpEndpoint<P>
Source§impl Ord for IpAddrV6
impl Ord for IpAddrV6
Source§impl PartialOrd for IpAddrV6
impl PartialOrd for IpAddrV6
Source§impl SubAssign<i64> for IpAddrV6
impl SubAssign<i64> for IpAddrV6
Source§fn sub_assign(&mut self, rhs: i64)
fn sub_assign(&mut self, rhs: i64)
-=
operation. Read more