#[non_exhaustive]pub enum NameError {
LabelTooLong(LabelTooLongDetail),
NameTooLong(NameTooLongDetail),
EmptyLabel,
}Expand description
Reasons a string cannot be accepted as a Name.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
LabelTooLong(LabelTooLongDetail)
A single label exceeded MAX_LABEL_BYTES.
NameTooLong(NameTooLongDetail)
The complete name exceeded MAX_NAME_BYTES.
EmptyLabel
The input contained an empty label (e.g. consecutive dots).
Implementations§
Source§impl NameError
impl NameError
Sourcepub const fn is_label_too_long(&self) -> bool
pub const fn is_label_too_long(&self) -> bool
Returns true if this value is of type LabelTooLong. Returns false otherwise
Sourcepub const fn is_name_too_long(&self) -> bool
pub const fn is_name_too_long(&self) -> bool
Returns true if this value is of type NameTooLong. Returns false otherwise
Sourcepub const fn is_empty_label(&self) -> bool
pub const fn is_empty_label(&self) -> bool
Returns true if this value is of type EmptyLabel. Returns false otherwise
Source§impl NameError
impl NameError
Sourcepub fn unwrap_label_too_long(self) -> LabelTooLongDetail
pub fn unwrap_label_too_long(self) -> LabelTooLongDetail
Unwraps this value to the NameError::LabelTooLong variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_label_too_long_ref(&self) -> &LabelTooLongDetail
pub fn unwrap_label_too_long_ref(&self) -> &LabelTooLongDetail
Unwraps this reference to the NameError::LabelTooLong variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_name_too_long(self) -> NameTooLongDetail
pub fn unwrap_name_too_long(self) -> NameTooLongDetail
Unwraps this value to the NameError::NameTooLong variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_name_too_long_ref(&self) -> &NameTooLongDetail
pub fn unwrap_name_too_long_ref(&self) -> &NameTooLongDetail
Unwraps this reference to the NameError::NameTooLong variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_empty_label(self)
pub fn unwrap_empty_label(self)
Unwraps this value to the NameError::EmptyLabel variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_empty_label_ref(&self)
pub fn unwrap_empty_label_ref(&self)
Unwraps this reference to the NameError::EmptyLabel variant.
Panics if this value is of any other type.
Source§impl NameError
impl NameError
Sourcepub fn try_unwrap_label_too_long(
self,
) -> Result<LabelTooLongDetail, TryUnwrapError<Self>>
pub fn try_unwrap_label_too_long( self, ) -> Result<LabelTooLongDetail, TryUnwrapError<Self>>
Attempts to unwrap this value to the NameError::LabelTooLong variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_label_too_long_ref(
&self,
) -> Result<&LabelTooLongDetail, TryUnwrapError<&Self>>
pub fn try_unwrap_label_too_long_ref( &self, ) -> Result<&LabelTooLongDetail, TryUnwrapError<&Self>>
Attempts to unwrap this reference to the NameError::LabelTooLong variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_name_too_long(
self,
) -> Result<NameTooLongDetail, TryUnwrapError<Self>>
pub fn try_unwrap_name_too_long( self, ) -> Result<NameTooLongDetail, TryUnwrapError<Self>>
Attempts to unwrap this value to the NameError::NameTooLong variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_name_too_long_ref(
&self,
) -> Result<&NameTooLongDetail, TryUnwrapError<&Self>>
pub fn try_unwrap_name_too_long_ref( &self, ) -> Result<&NameTooLongDetail, TryUnwrapError<&Self>>
Attempts to unwrap this reference to the NameError::NameTooLong variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_empty_label(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_empty_label(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the NameError::EmptyLabel variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_empty_label_ref(&self) -> Result<(), TryUnwrapError<&Self>>
pub fn try_unwrap_empty_label_ref(&self) -> Result<(), TryUnwrapError<&Self>>
Attempts to unwrap this reference to the NameError::EmptyLabel variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Trait Implementations§
impl Copy for NameError
impl Eq for NameError
Source§impl Error for NameError
impl Error for NameError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()