#[non_exhaustive]pub enum ParseError {
BufferTooShort(BufferTooShortDetail),
LabelTooLong(LabelTooLongDetail),
NameTooLong(usize),
PointerCycle,
PointerChainTooLong(u8),
PointerForward(PointerForwardDetail),
InvalidLabelKind(u8),
RdlengthOverrun(RdlengthOverrunDetail),
IntegerConversion(TryFromIntError),
UnsupportedNameBearingType(u16),
}Expand description
Errors raised while parsing an mDNS message off the wire.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BufferTooShort(BufferTooShortDetail)
Parser ran out of input bytes.
LabelTooLong(LabelTooLongDetail)
A label length byte exceeded MAX_LABEL_BYTES.
NameTooLong(usize)
A fully-resolved name exceeded MAX_NAME_BYTES.
PointerCycle
A compression pointer chain pointed back to a name still being resolved.
PointerChainTooLong(u8)
A compression pointer chain exceeded MAX_POINTER_HOPS hops.
PointerForward(PointerForwardDetail)
A compression pointer pointed forward (>= current position), violating RFC 1035 §4.1.4.
InvalidLabelKind(u8)
The top two bits of a label byte did not match a known label kind.
RdlengthOverrun(RdlengthOverrunDetail)
A resource record’s rdlength ran past the end of the message.
IntegerConversion(TryFromIntError)
An integer conversion failed.
UnsupportedNameBearingType(u16)
A well-known name-bearing RR type (e.g. NS, SOA, MX, DNAME) that this mDNS/DNS-SD stack does not type-specifically parse. Its RDATA may carry a compressed/case-varied domain name that cannot be canonicalized for storage or identity, so callers drop the record rather than cache a compression-sensitive, non-dedupable entry.
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub const fn is_buffer_too_short(&self) -> bool
pub const fn is_buffer_too_short(&self) -> bool
Returns true if this value is of type BufferTooShort. Returns false otherwise
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_pointer_cycle(&self) -> bool
pub const fn is_pointer_cycle(&self) -> bool
Returns true if this value is of type PointerCycle. Returns false otherwise
Sourcepub const fn is_pointer_chain_too_long(&self) -> bool
pub const fn is_pointer_chain_too_long(&self) -> bool
Returns true if this value is of type PointerChainTooLong. Returns false otherwise
Sourcepub const fn is_pointer_forward(&self) -> bool
pub const fn is_pointer_forward(&self) -> bool
Returns true if this value is of type PointerForward. Returns false otherwise
Sourcepub const fn is_invalid_label_kind(&self) -> bool
pub const fn is_invalid_label_kind(&self) -> bool
Returns true if this value is of type InvalidLabelKind. Returns false otherwise
Sourcepub const fn is_rdlength_overrun(&self) -> bool
pub const fn is_rdlength_overrun(&self) -> bool
Returns true if this value is of type RdlengthOverrun. Returns false otherwise
Sourcepub const fn is_integer_conversion(&self) -> bool
pub const fn is_integer_conversion(&self) -> bool
Returns true if this value is of type IntegerConversion. Returns false otherwise
Sourcepub const fn is_unsupported_name_bearing_type(&self) -> bool
pub const fn is_unsupported_name_bearing_type(&self) -> bool
Returns true if this value is of type UnsupportedNameBearingType. Returns false otherwise
Source§impl ParseError
impl ParseError
Sourcepub fn unwrap_buffer_too_short(self) -> BufferTooShortDetail
pub fn unwrap_buffer_too_short(self) -> BufferTooShortDetail
Unwraps this value to the ParseError::BufferTooShort variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_buffer_too_short_ref(&self) -> &BufferTooShortDetail
pub fn unwrap_buffer_too_short_ref(&self) -> &BufferTooShortDetail
Unwraps this reference to the ParseError::BufferTooShort variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_label_too_long(self) -> LabelTooLongDetail
pub fn unwrap_label_too_long(self) -> LabelTooLongDetail
Unwraps this value to the ParseError::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 ParseError::LabelTooLong variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_name_too_long(self) -> usize
pub fn unwrap_name_too_long(self) -> usize
Unwraps this value to the ParseError::NameTooLong variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_name_too_long_ref(&self) -> &usize
pub fn unwrap_name_too_long_ref(&self) -> &usize
Unwraps this reference to the ParseError::NameTooLong variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_pointer_cycle(self)
pub fn unwrap_pointer_cycle(self)
Unwraps this value to the ParseError::PointerCycle variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_pointer_cycle_ref(&self)
pub fn unwrap_pointer_cycle_ref(&self)
Unwraps this reference to the ParseError::PointerCycle variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_pointer_chain_too_long(self) -> u8
pub fn unwrap_pointer_chain_too_long(self) -> u8
Unwraps this value to the ParseError::PointerChainTooLong variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_pointer_chain_too_long_ref(&self) -> &u8
pub fn unwrap_pointer_chain_too_long_ref(&self) -> &u8
Unwraps this reference to the ParseError::PointerChainTooLong variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_pointer_forward(self) -> PointerForwardDetail
pub fn unwrap_pointer_forward(self) -> PointerForwardDetail
Unwraps this value to the ParseError::PointerForward variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_pointer_forward_ref(&self) -> &PointerForwardDetail
pub fn unwrap_pointer_forward_ref(&self) -> &PointerForwardDetail
Unwraps this reference to the ParseError::PointerForward variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_invalid_label_kind(self) -> u8
pub fn unwrap_invalid_label_kind(self) -> u8
Unwraps this value to the ParseError::InvalidLabelKind variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_invalid_label_kind_ref(&self) -> &u8
pub fn unwrap_invalid_label_kind_ref(&self) -> &u8
Unwraps this reference to the ParseError::InvalidLabelKind variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_rdlength_overrun(self) -> RdlengthOverrunDetail
pub fn unwrap_rdlength_overrun(self) -> RdlengthOverrunDetail
Unwraps this value to the ParseError::RdlengthOverrun variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_rdlength_overrun_ref(&self) -> &RdlengthOverrunDetail
pub fn unwrap_rdlength_overrun_ref(&self) -> &RdlengthOverrunDetail
Unwraps this reference to the ParseError::RdlengthOverrun variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_integer_conversion(self) -> TryFromIntError
pub fn unwrap_integer_conversion(self) -> TryFromIntError
Unwraps this value to the ParseError::IntegerConversion variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_integer_conversion_ref(&self) -> &TryFromIntError
pub fn unwrap_integer_conversion_ref(&self) -> &TryFromIntError
Unwraps this reference to the ParseError::IntegerConversion variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_unsupported_name_bearing_type(self) -> u16
pub fn unwrap_unsupported_name_bearing_type(self) -> u16
Unwraps this value to the ParseError::UnsupportedNameBearingType variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_unsupported_name_bearing_type_ref(&self) -> &u16
pub fn unwrap_unsupported_name_bearing_type_ref(&self) -> &u16
Unwraps this reference to the ParseError::UnsupportedNameBearingType variant.
Panics if this value is of any other type.
Source§impl ParseError
impl ParseError
Sourcepub fn try_unwrap_buffer_too_short(
self,
) -> Result<BufferTooShortDetail, TryUnwrapError<Self>>
pub fn try_unwrap_buffer_too_short( self, ) -> Result<BufferTooShortDetail, TryUnwrapError<Self>>
Attempts to unwrap this value to the ParseError::BufferTooShort variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_buffer_too_short_ref(
&self,
) -> Result<&BufferTooShortDetail, TryUnwrapError<&Self>>
pub fn try_unwrap_buffer_too_short_ref( &self, ) -> Result<&BufferTooShortDetail, TryUnwrapError<&Self>>
Attempts to unwrap this reference to the ParseError::BufferTooShort variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
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 ParseError::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 ParseError::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<usize, TryUnwrapError<Self>>
pub fn try_unwrap_name_too_long(self) -> Result<usize, TryUnwrapError<Self>>
Attempts to unwrap this value to the ParseError::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<&usize, TryUnwrapError<&Self>>
pub fn try_unwrap_name_too_long_ref( &self, ) -> Result<&usize, TryUnwrapError<&Self>>
Attempts to unwrap this reference to the ParseError::NameTooLong variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_pointer_cycle(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_pointer_cycle(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the ParseError::PointerCycle variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_pointer_cycle_ref(&self) -> Result<(), TryUnwrapError<&Self>>
pub fn try_unwrap_pointer_cycle_ref(&self) -> Result<(), TryUnwrapError<&Self>>
Attempts to unwrap this reference to the ParseError::PointerCycle variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_pointer_chain_too_long(
self,
) -> Result<u8, TryUnwrapError<Self>>
pub fn try_unwrap_pointer_chain_too_long( self, ) -> Result<u8, TryUnwrapError<Self>>
Attempts to unwrap this value to the ParseError::PointerChainTooLong variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_pointer_chain_too_long_ref(
&self,
) -> Result<&u8, TryUnwrapError<&Self>>
pub fn try_unwrap_pointer_chain_too_long_ref( &self, ) -> Result<&u8, TryUnwrapError<&Self>>
Attempts to unwrap this reference to the ParseError::PointerChainTooLong variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_pointer_forward(
self,
) -> Result<PointerForwardDetail, TryUnwrapError<Self>>
pub fn try_unwrap_pointer_forward( self, ) -> Result<PointerForwardDetail, TryUnwrapError<Self>>
Attempts to unwrap this value to the ParseError::PointerForward variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_pointer_forward_ref(
&self,
) -> Result<&PointerForwardDetail, TryUnwrapError<&Self>>
pub fn try_unwrap_pointer_forward_ref( &self, ) -> Result<&PointerForwardDetail, TryUnwrapError<&Self>>
Attempts to unwrap this reference to the ParseError::PointerForward variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_invalid_label_kind(self) -> Result<u8, TryUnwrapError<Self>>
pub fn try_unwrap_invalid_label_kind(self) -> Result<u8, TryUnwrapError<Self>>
Attempts to unwrap this value to the ParseError::InvalidLabelKind variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_invalid_label_kind_ref(
&self,
) -> Result<&u8, TryUnwrapError<&Self>>
pub fn try_unwrap_invalid_label_kind_ref( &self, ) -> Result<&u8, TryUnwrapError<&Self>>
Attempts to unwrap this reference to the ParseError::InvalidLabelKind variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_rdlength_overrun(
self,
) -> Result<RdlengthOverrunDetail, TryUnwrapError<Self>>
pub fn try_unwrap_rdlength_overrun( self, ) -> Result<RdlengthOverrunDetail, TryUnwrapError<Self>>
Attempts to unwrap this value to the ParseError::RdlengthOverrun variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_rdlength_overrun_ref(
&self,
) -> Result<&RdlengthOverrunDetail, TryUnwrapError<&Self>>
pub fn try_unwrap_rdlength_overrun_ref( &self, ) -> Result<&RdlengthOverrunDetail, TryUnwrapError<&Self>>
Attempts to unwrap this reference to the ParseError::RdlengthOverrun variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_integer_conversion(
self,
) -> Result<TryFromIntError, TryUnwrapError<Self>>
pub fn try_unwrap_integer_conversion( self, ) -> Result<TryFromIntError, TryUnwrapError<Self>>
Attempts to unwrap this value to the ParseError::IntegerConversion variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_integer_conversion_ref(
&self,
) -> Result<&TryFromIntError, TryUnwrapError<&Self>>
pub fn try_unwrap_integer_conversion_ref( &self, ) -> Result<&TryFromIntError, TryUnwrapError<&Self>>
Attempts to unwrap this reference to the ParseError::IntegerConversion variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_unsupported_name_bearing_type(
self,
) -> Result<u16, TryUnwrapError<Self>>
pub fn try_unwrap_unsupported_name_bearing_type( self, ) -> Result<u16, TryUnwrapError<Self>>
Attempts to unwrap this value to the ParseError::UnsupportedNameBearingType variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_unsupported_name_bearing_type_ref(
&self,
) -> Result<&u16, TryUnwrapError<&Self>>
pub fn try_unwrap_unsupported_name_bearing_type_ref( &self, ) -> Result<&u16, TryUnwrapError<&Self>>
Attempts to unwrap this reference to the ParseError::UnsupportedNameBearingType variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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()