inet 0.1.1

This library aids in internet processing.
Documentation
pub use v4::*;
pub use v6::*;

mod v4;
mod v6;

/// Represents either an IPv4 address or an IPv6 address.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub enum IPAddress {

    // An IPv4 Address
    V4(IPv4Address),

    // An IPv6 Address
    V6(IPv6Address),
}

impl ToString for IPAddress {

    /// ```
    /// use inet::ip::{IPv4Address, IPAddress, IPv6Address};
    ///
    /// assert_eq!(IPAddress::V4(IPv4Address::LOCALHOST).to_string(), "127.0.0.1");
    /// assert_eq!(IPAddress::V6(IPv6Address::LOCALHOST).to_string(), "::1");
    /// ```
    fn to_string(&self) -> String {
        match self {
            IPAddress::V4(ip) => ip.to_string(),
            IPAddress::V6(ip) => ip.to_string(),
        }
    }
}