diff --git a/src/host.rs b/src/host.rs index d510cfe..45e27f3 100644 --- a/src/host.rs +++ b/src/host.rs @@ -1,3 +1,16 @@ +//! This module contains a data structure representing dns +//! hosts which can be readily parsed from or converted to strings. +//! # Examples +//! Parse a host from a given string +//! ``` +//! use dory::host::Host; +//! +//! let host_str = "misfin.example.com"; +//! let host: Host = host_str.parse().unwrap(); +//! assert_eq!(host.subdomain.unwrap().as_str(), "misfin"); +//! assert_eq!(host.domain.as_str(), "example"); +//! assert_eq!(host.tld.as_str(), "com"); +//! ``` use std::{fmt, str::FromStr}; #[derive(Clone, Debug, Default, PartialEq)]