pub enum Format {
Uuid,
Email,
Hostname,
Ipv4,
Ipv6,
}Expand description
A named format a string must satisfy.
Variants§
Uuid
8-4-4-4-12 lowercase or uppercase hex. Any version, any variant:
version bits are a fact about who generated it, not about whether the
value is a UUID.
A structural check only: one @, a non-empty local part, and a domain
that looks like a hostname.
Deliberately not RFC 5322, which admits comments, quoted strings and nested parentheses that no mail system in use accepts. Deliberately not a deliverability check either — that needs the network, and a validator that reached the network at a boundary would be a much worse idea than a permissive check.
Hostname
A DNS hostname per RFC 1123: dot-separated labels of letters, digits and hyphens, each 1 to 63 characters, not starting or ending with a hyphen, 253 characters in total.
Ipv4
Four decimal octets. Leading zeros are rejected, because 010 is octal
to some resolvers and decimal to others, and a value that means two
different things on two hosts is exactly what this project exists to
refuse.
Ipv6
An IPv6 address, including the :: short form and a trailing IPv4
part. Zone identifiers (%eth0) are rejected: they name an interface
on one machine and mean nothing on another.