pub struct NameRef<'a> { /* private fields */ }Expand description
Zero-copy DNS name reference into a message buffer.
Implementations§
Source§impl<'a> NameRef<'a>
impl<'a> NameRef<'a>
Sourcepub fn try_parse(
message: &'a [u8],
offset: usize,
) -> Result<(NameRef<'a>, usize), ParseError>
pub fn try_parse( message: &'a [u8], offset: usize, ) -> Result<(NameRef<'a>, usize), ParseError>
Parses a name starting at offset in message. Returns the NameRef
and the number of bytes consumed at the inline position (i.e. how
far to advance the parser past this name in the original section —
not how long the fully-resolved name is).
Sourcepub fn labels(&self) -> NameLabels<'a> ⓘ
pub fn labels(&self) -> NameLabels<'a> ⓘ
Returns an iterator over the labels of this name, following pointers with a bounded hop count.
Sourcepub const fn start(&self) -> u16
pub const fn start(&self) -> u16
Returns the byte offset at which this name begins in the message.
Sourcepub fn equals_ignoring_case(&self, other: &NameRef<'_>) -> bool
pub fn equals_ignoring_case(&self, other: &NameRef<'_>) -> bool
Compares two names case-insensitively (mDNS rule, RFC 6762 §16).
Trait Implementations§
impl<'a> Copy for NameRef<'a>
impl<'a> Eq for NameRef<'a>
Source§impl<'a> PartialEq for NameRef<'a>
impl<'a> PartialEq for NameRef<'a>
impl<'a> StructuralPartialEq for NameRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for NameRef<'a>
impl<'a> RefUnwindSafe for NameRef<'a>
impl<'a> Send for NameRef<'a>
impl<'a> Sync for NameRef<'a>
impl<'a> Unpin for NameRef<'a>
impl<'a> UnsafeUnpin for NameRef<'a>
impl<'a> UnwindSafe for NameRef<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more