inet 0.1.1

This library aids in internet processing.
Documentation
/// Represents an IPv6 address.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub struct IPv6Address {
    pub chunks: [u16; 8],
}

impl IPv6Address {

    /// The unspecified address.
    pub const UNSPECIFIED: IPv6Address =
        IPv6Address::new(0, 0, 0, 0, 0, 0, 0, 0);

    /// The localhost address.
    pub const LOCALHOST: IPv6Address =
        IPv6Address::new(0, 0, 0, 0, 0, 0, 0, 1);
}

impl IPv6Address {

    /// Creates a new IPv6Address from the bytes.
    ///
    /// ```
    /// use inet::ip::IPv6Address;
    ///
    /// assert_eq!(IPv6Address::new(0, 0, 0, 0, 0, 0, 0, 0), IPv6Address::UNSPECIFIED);
    /// assert_eq!(IPv6Address::new(0, 0, 0, 0, 0, 0, 0, 1), IPv6Address::LOCALHOST);
    /// ```
    pub const fn new(
            a: u16, b: u16, c: u16, d: u16,
            e: u16, f: u16, g: u16, h: u16)
            -> IPv6Address {
        IPv6Address{ chunks: [a, b, c, d, e, f, g, h] }
    }
}

impl IPv6Address {

    /// Checks if the address is the unspecified address.
    ///
    /// ```
    /// use inet::ip::IPv6Address;
    ///
    /// assert!(IPv6Address::UNSPECIFIED.is_unspecified());
    /// assert!(!IPv6Address::LOCALHOST.is_unspecified());
    /// ```
    pub fn is_unspecified(&self) -> bool {
        self == &IPv6Address::UNSPECIFIED
    }

    /// Checks if the address is a loopback address.
    ///
    /// ```
    /// use inet::ip::IPv6Address;
    ///
    /// assert!(!IPv6Address::UNSPECIFIED.is_loopback());
    /// assert!(IPv6Address::LOCALHOST.is_loopback());
    /// ```
    pub fn is_loopback(&self) -> bool {
        self == &IPv6Address::LOCALHOST
    }
}

impl ToString for IPv6Address {

    /// ```
    /// use inet::ip::IPv6Address;
    ///
    /// assert_eq!(IPv6Address::UNSPECIFIED.to_string(), "::");
    /// assert_eq!(IPv6Address::LOCALHOST.to_string(), "::1");
    /// ```
    fn to_string(&self) -> String {
        use std::net::Ipv6Addr;
        Ipv6Addr::from(self.chunks).to_string()
    }
}