An implementation of Mozilla's Public Suffix List in Rust
If all you want is to do syntax checks, you can now just create an empty list to still take advantage of this library's domain and email parsing engines. Here is an example:-
let list = List::empty();
if list.parse_email("甲斐@黒川.日本").is_ok() {
// this is a valid email address
}
If this is all you use the library for, don't forget to disable default-features
in your Cargo.toml
so you don't download unnecessary dependencies.
This release adds support for validating the local-part
of an email address.
Add support for validating email addresses
Instead of having to specify whether you are parsing a domain, a host or a URL, now you can just call List::parse_str
and it will extract a host from that string if any.
Now you can parse URLs using List::parse_url
or hosts that can potentially be IP addresses using List::parse_host
.
List::parse_domain
rejects everything that is not a domain name. While this is very useful, domains and IP addresses are usually used interchangeably. Having to first check whether a host is an IP address before trying to parse it as a domain is not very convenient, hence List::parse_host
. List::parse_url
takes it a step further and allows you to just pass in a URL instead.