[][src]Trait addr_hal::Ipv6Address

pub trait Ipv6Address: Clone + Copy + PartialEq + PartialOrd + Eq + Ord {
    const LOCALHOST: Self;
    const UNSPECIFIED: Self;

    fn new(
        a: u16,
        b: u16,
        c: u16,
        d: u16,
        e: u16,
        f: u16,
        g: u16,
        h: u16
    ) -> Self;
fn segments(&self) -> [u16; 8]; }

Describe the internal data structure behavior of Ipv6Addr.

You can implement this trait by yourself or use ffi for specific Platform.

Examples

use addr_hal::Ipv6Address;

#[derive(Clone, Copy, PartialOrd, PartialEq, Eq, Ord)]
struct Ipv6AddrInner {
    inner: [u16; 8],
}

impl Ipv6Address for Ipv6AddrInner {
    const LOCALHOST: Self = Self {
        inner: [0, 0, 0, 0, 0, 0, 0, 1],
    };
    const UNSPECIFIED: Self = Self {
        inner: [0, 0, 0, 0, 0, 0, 0, 0],
    };
    fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u16, h: u16) -> Self {
        Self {
            inner: [a, b, c, d, e, f, g, h],
        }
    }

    fn segments(&self) -> [u16; 8] {
        self.inner.clone()
    }
}

Associated Constants

const LOCALHOST: Self

const UNSPECIFIED: Self

Loading content...

Required methods

fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u16, h: u16) -> Self

fn segments(&self) -> [u16; 8]

Loading content...

Implementors

Loading content...