Skip to main content

ParseError

Enum ParseError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

Source

pub const fn is_buffer_too_short(&self) -> bool

Returns true if this value is of type BufferTooShort. Returns false otherwise

Source

pub const fn is_label_too_long(&self) -> bool

Returns true if this value is of type LabelTooLong. Returns false otherwise

Source

pub const fn is_name_too_long(&self) -> bool

Returns true if this value is of type NameTooLong. Returns false otherwise

Source

pub const fn is_pointer_cycle(&self) -> bool

Returns true if this value is of type PointerCycle. Returns false otherwise

Source

pub const fn is_pointer_chain_too_long(&self) -> bool

Returns true if this value is of type PointerChainTooLong. Returns false otherwise

Source

pub const fn is_pointer_forward(&self) -> bool

Returns true if this value is of type PointerForward. Returns false otherwise

Source

pub const fn is_invalid_label_kind(&self) -> bool

Returns true if this value is of type InvalidLabelKind. Returns false otherwise

Source

pub const fn is_rdlength_overrun(&self) -> bool

Returns true if this value is of type RdlengthOverrun. Returns false otherwise

Source

pub const fn is_integer_conversion(&self) -> bool

Returns true if this value is of type IntegerConversion. Returns false otherwise

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn unwrap_pointer_cycle(self)

Unwraps this value to the ParseError::PointerCycle variant. Panics if this value is of any other type.

Source

pub fn unwrap_pointer_cycle_ref(&self)

Unwraps this reference to the ParseError::PointerCycle variant. Panics if this value is of any other type.

Source

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.

Source

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.

Source

pub fn unwrap_pointer_forward(self) -> PointerForwardDetail

Unwraps this value to the ParseError::PointerForward variant. Panics if this value is of any other type.

Source

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.

Source

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.

Source

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.

Source

pub fn unwrap_rdlength_overrun(self) -> RdlengthOverrunDetail

Unwraps this value to the ParseError::RdlengthOverrun variant. Panics if this value is of any other type.

Source

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.

Source

pub fn unwrap_integer_conversion(self) -> TryFromIntError

Unwraps this value to the ParseError::IntegerConversion variant. Panics if this value is of any other type.

Source

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.

Source

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.

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> ParseError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ParseError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ParseError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ParseError> for HandleError

Source§

fn from(source: ParseError) -> Self

Converts to this type from the input type.
Source§

impl From<TryFromIntError> for ParseError

Source§

fn from(source: TryFromIntError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more