Expand description
§disposable-email-domains
Fast, dependency-light checking of disposable / temporary email domains,
built from the community-maintained
disposable-email-domains/disposable-email-domains
dataset (CC0-licensed, ~8,000 domains and growing).
The domain list is embedded at compile time as a perfect hash set
(phf), so lookups are O(1), allocation-light,
and require no filesystem or network access at runtime.
use dispocheck::is_disposable_email;
assert!(is_disposable_email("someone@mailinator.com"));
assert!(!is_disposable_email("someone@gmail.com"));§Subdomain matching
The upstream list stores second-level (or, for public-suffix domains,
third-level) domains. A blocked entry also blocks any subdomain of it,
e.g. if mailinator.com is listed, foo.mailinator.com is also treated
as disposable:
use dispocheck::is_disposable_domain;
assert!(is_disposable_domain("sub.mailinator.com"));§Custom / runtime lists
If you need to merge the embedded list with your own domains, or refresh
the list at runtime without recompiling, use Blocklist (requires the
default std feature).
§Freshness
The upstream dataset changes daily. This crate’s embedded list is
refreshed and republished automatically by CI — see the crate’s
repository for the update cadence and the exact upstream commit each
release was built from (recorded in data/SOURCE_COMMIT).
Structs§
- Blocklist
- A mutable, in-memory blocklist that starts from the crate’s embedded dataset and can be extended (or fully replaced) at runtime.
Functions§
- is_
disposable_ domain - Returns
trueifdomain, or any of its parent domains, is a known disposable/temporary email domain. - is_
disposable_ email - Returns
trueifemail’s domain (or one of its parent domains) is a known disposable/temporary email domain. - is_
empty - Returns
trueif the embedded blocklist is empty. Alwaysfalsein practice; the build script refuses to compile an implausibly small list. - iter
- Returns an iterator over every domain in the embedded blocklist.
- len
- Returns the total number of domains in the embedded blocklist.