Add doc comment and example for host
module
This commit is contained in:
parent
7bbdb1381d
commit
c3891cb485
1 changed files with 13 additions and 0 deletions
13
src/host.rs
13
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)]
|
||||
|
|
Loading…
Add table
Reference in a new issue