#[non_exhaustive]pub enum HostnameError {
Empty,
TooLong(usize),
LabelTooLong {
label: usize,
len: usize,
},
InvalidLabelStart(char),
InvalidLabelEnd(char),
InvalidChar(char),
EmptyLabel,
}net only.Expand description
Error type for hostname validation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Empty
Empty hostname
The provided string is empty. Hostnames must contain at least one character.
TooLong(usize)
Hostname exceeds maximum length of 253 characters
According to RFC 1123, hostnames must not exceed 253 characters. This variant contains the actual length of the provided hostname.
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 a letter (a-z, A-Z). Hyphens and digits are not allowed as the first character. This variant contains the invalid character.
InvalidLabelEnd(char)
Label ends with invalid character
Labels must end with a letter (a-z, A-Z) or digit (0-9). Hyphens are not allowed as the last character. This variant contains the invalid character.
InvalidChar(char)
Invalid character in hostname
Hostnames 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 HostnameError
impl Clone for HostnameError
Source§fn clone(&self) -> HostnameError
fn clone(&self) -> HostnameError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HostnameError
impl Debug for HostnameError
Source§impl<'de> Deserialize<'de> for HostnameError
impl<'de> Deserialize<'de> for HostnameError
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 HostnameError
impl Display for HostnameError
Source§impl Error for HostnameError
Available on crate feature std only.
impl Error for HostnameError
std only.