Skip to main content

utopia_domains/
lib.rs

1//! Domain names against the Public Suffix List.
2//!
3//! | PHP | Rust |
4//! |---|---|
5//! | `Utopia\Domains\Domain` | [`Domain`] |
6//! | `new Domain($domain)` | [`Domain::new`] (the global list) or [`Domain::with_list`] |
7//! | `get()`, `getApex()`, `getTLD()`, `getSuffix()`, `getRule()` | [`Domain::get`], [`Domain::apex`], [`Domain::tld`], [`Domain::suffix`], [`Domain::rule`] |
8//! | `getRegisterable()`, `getName()`, `getSub()` | [`Domain::registerable`], [`Domain::name`], [`Domain::sub`] |
9//! | `isKnown()`, `isICANN()`, `isPrivate()`, `isTest()` | [`Domain::is_known`], [`Domain::is_icann`], [`Domain::is_private`], [`Domain::is_test`] |
10//! | `data/data.php` (the list `Domain` includes) | [`PublicSuffixList`] ([`PublicSuffixList::EMBEDDED`]) |
11//!
12//! The Public Suffix List is embedded in the crate
13//! (`data/public-suffix-list.txt`, exported from the PHP package's
14//! `data/data.php` by `data/export.php`) and parsed once, on first use,
15//! unless a list is installed with [`PublicSuffixList::install`].
16//!
17//! PHP: the registrars and validators of `utopia-php/domains` are not ported
18//! here; the registrars make network calls, which stay in PHP.
19
20#![warn(missing_docs)]
21
22mod domain;
23mod error;
24
25pub use domain::{Domain, PublicSuffixList, Section};
26pub use error::Error;
27
28/// The getting started guide (`guide.md`), compiled and run with the doctests.
29#[cfg(doctest)]
30#[doc = include_str!("../guide.md")]
31pub struct GettingStarted;