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<(Self, usize), ParseError>
pub fn try_parse( message: &'a [u8], offset: usize, ) -> Result<(Self, 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