1.0.0[][src]Struct validators::prelude::validators_prelude::Ipv6Addr

pub struct Ipv6Addr { /* fields omitted */ }

An IPv6 address.

IPv6 addresses are defined as 128-bit integers in IETF RFC 4291. They are usually represented as eight 16-bit segments.

See IpAddr for a type encompassing both IPv4 and IPv6 addresses.

The size of an Ipv6Addr struct may vary depending on the target operating system.

Textual representation

Ipv6Addr provides a FromStr implementation. There are many ways to represent an IPv6 address in text, but in general, each segments is written in hexadecimal notation, and segments are separated by :. For more information, see IETF RFC 5952.

Examples

use std::net::Ipv6Addr;

let localhost = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1);
assert_eq!("::1".parse(), Ok(localhost));
assert_eq!(localhost.is_loopback(), true);

Trait Implementations

impl Clone for Ipv6Addr[src]

impl Copy for Ipv6Addr[src]

impl Debug for Ipv6Addr[src]

impl<'de> Deserialize<'de> for Ipv6Addr[src]

impl Display for Ipv6Addr[src]

Write an Ipv6Addr, conforming to the canonical style described by RFC 5952.

impl Eq for Ipv6Addr[src]

impl From<[u16; 8]> for Ipv6Addr1.16.0[src]

fn from(segments: [u16; 8]) -> Ipv6Addr[src]

Creates an Ipv6Addr from an eight element 16-bit array.

Examples

use std::net::Ipv6Addr;

let addr = Ipv6Addr::from([
    525u16, 524u16, 523u16, 522u16,
    521u16, 520u16, 519u16, 518u16,
]);
assert_eq!(
    Ipv6Addr::new(
        0x20d, 0x20c,
        0x20b, 0x20a,
        0x209, 0x208,
        0x207, 0x206
    ),
    addr
);

impl From<[u8; 16]> for Ipv6Addr1.9.0[src]

fn from(octets: [u8; 16]) -> Ipv6Addr[src]

Creates an Ipv6Addr from a sixteen element byte array.

Examples

use std::net::Ipv6Addr;

let addr = Ipv6Addr::from([
    25u8, 24u8, 23u8, 22u8, 21u8, 20u8, 19u8, 18u8,
    17u8, 16u8, 15u8, 14u8, 13u8, 12u8, 11u8, 10u8,
]);
assert_eq!(
    Ipv6Addr::new(
        0x1918, 0x1716,
        0x1514, 0x1312,
        0x1110, 0x0f0e,
        0x0d0c, 0x0b0a
    ),
    addr
);

impl From<Ipv6Addr> for IpAddr1.16.0[src]

fn from(ipv6: Ipv6Addr) -> IpAddr[src]

Copies this address to a new IpAddr::V6.

Examples

use std::net::{IpAddr, Ipv6Addr};

let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);

assert_eq!(
    IpAddr::V6(addr),
    IpAddr::from(addr)
);

impl From<u128> for Ipv6Addr1.26.0[src]

fn from(ip: u128) -> Ipv6Addr[src]

Convert a host byte order u128 into an Ipv6Addr.

Examples

use std::net::Ipv6Addr;

let addr = Ipv6Addr::from(0x102030405060708090A0B0C0D0E0F00D_u128);
assert_eq!(
    Ipv6Addr::new(
        0x1020, 0x3040, 0x5060, 0x7080,
        0x90A0, 0xB0C0, 0xD0E0, 0xF00D,
    ),
    addr);

impl<'v> FromFormValue<'v> for Ipv6Addr[src]

type Error = &'v RawStr

The associated error which can be returned from parsing. It is a good idea to have the return type be or contain an &'v str so that the unparseable string can be examined after a bad parse. Read more

impl<'a> FromParam<'a> for Ipv6Addr[src]

type Error = &'a RawStr

The associated error to be returned if parsing/validation fails.

impl FromStr for Ipv6Addr[src]

type Err = AddrParseError

The associated error which can be returned from parsing.

impl<'x, P> FromUriParam<P, &'x Ipv6Addr> for Ipv6Addr where
    P: UriPart, 

type Target = &'x Ipv6Addr

The resulting type of this conversion.

impl<'x, P> FromUriParam<P, &'x mut Ipv6Addr> for Ipv6Addr where
    P: UriPart, 

type Target = &'x mut Ipv6Addr

The resulting type of this conversion.

impl<P> FromUriParam<P, Ipv6Addr> for Ipv6Addr where
    P: UriPart, 

type Target = Ipv6Addr

The resulting type of this conversion.

impl Hash for Ipv6Addr[src]

impl Ord for Ipv6Addr[src]

impl PartialEq<IpAddr> for Ipv6Addr1.16.0[src]

impl PartialEq<Ipv6Addr> for IpAddr1.16.0[src]

impl PartialEq<Ipv6Addr> for Ipv6Addr[src]

impl PartialOrd<IpAddr> for Ipv6Addr1.16.0[src]

impl PartialOrd<Ipv6Addr> for IpAddr1.16.0[src]

impl PartialOrd<Ipv6Addr> for Ipv6Addr[src]

impl Serialize for Ipv6Addr[src]

impl<P> UriDisplay<P> for Ipv6Addr where
    P: UriPart, 

This implementation is identical to the Display implementation.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, I> AsResult<T, I> for T where
    I: Input, 

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoCollection<T> for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,