inet 0.1.1

This library aids in internet processing.
Documentation
use crate::domain::Domain;

/// Represents a domain name with an associated port.
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub struct Authority {
    pub name: Domain,
    pub port: u16,
}

impl ToString for Authority {

    /// ```
    /// use inet::domain::Domain;
    /// use std::convert::TryFrom;
    /// use inet::authority::Authority;
    ///
    /// let domain: Domain = Domain::try_from("localhost".as_bytes()).ok().unwrap();
    /// let authority = Authority{ name: domain, port: 80 };
    /// assert_eq!(authority.to_string(), "localhost:80");
    /// ```
    fn to_string(&self) -> String {
        format!("{}:{}", self.name.name(), self.port)
    }
}