Rust

domain

Module

Domain names split against the Public Suffix List into suffix, registrable name and subdomain.

Contents

use utopia_domains::Domain;
Rust
pub struct Domain<'l>

A domain name, lower-cased, split against a PublicSuffixList into its suffix, registrable name and subdomain.

The suffix search runs once, on the first getter that needs it; the suffix, name and subdomain are then slices of the domain.

Rust
use utopia_domains::Domain;

let domain = Domain::new("Blog.Example.CO.UK")?;
assert_eq!(domain.get(), "blog.example.co.uk");
assert_eq!(domain.suffix(), "co.uk");
assert_eq!(domain.name(), "example");
assert_eq!(domain.sub(), "blog");
assert_eq!(domain.registerable(), "example.co.uk");
use utopia_domains::PublicSuffixList;
Rust
pub struct PublicSuffixList

The Public Suffix List: every rule as written (com, *.ck, !www.ck) with its section, plus the exception and wildcard rules indexed without their ! and *. prefixes.

use utopia_domains::Section;
Rust
pub enum Section

The section of the Public Suffix List a rule comes from.