#[non_exhaustive]pub enum DomainNameError {
Empty,
TooLong(usize),
LabelTooLong {
label: usize,
len: usize,
},
InvalidLabelStart(char),
InvalidLabelEnd(char),
InvalidChar(char),
EmptyLabel,
}net only.Expand description
Error type for domain name validation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Empty
Empty domain name
The provided string is empty. Domain names must contain at least one character.
TooLong(usize)
Domain name exceeds maximum length of 253 characters
According to RFC 1035, domain names must not exceed 253 characters. This variant contains the actual length of the provided domain name.
LabelTooLong
Label exceeds maximum length of 63 characters
Each label (segment separated by dots) must not exceed 63 characters. This variant contains the label index and its actual length.
InvalidLabelStart(char)
Label starts with invalid character
Labels must start with an alphanumeric character (letter or digit). Hyphens are not allowed as the first character. This variant contains the invalid character.
InvalidLabelEnd(char)
Label ends with invalid character
Labels must end with an alphanumeric character (letter or digit). Hyphens are not allowed as the last character. This variant contains the invalid character.
InvalidChar(char)
Invalid character in domain name
Domain names can only contain ASCII letters, digits, and hyphens. This variant contains the invalid character.
EmptyLabel
Empty label (consecutive dots or leading/trailing dots)
Consecutive dots (e.g., “example..com”) or leading/trailing dots (e.g., “.example.com” or “example.com.”) are not allowed.
Trait Implementations§
Source§impl Clone for DomainNameError
impl Clone for DomainNameError
Source§fn clone(&self) -> DomainNameError
fn clone(&self) -> DomainNameError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DomainNameError
impl Debug for DomainNameError
Source§impl<'de> Deserialize<'de> for DomainNameError
impl<'de> Deserialize<'de> for DomainNameError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for DomainNameError
impl Display for DomainNameError
Source§impl Error for DomainNameError
Available on crate feature std only.
impl Error for DomainNameError
std only.