pub struct Ref<'a> { /* private fields */ }Expand description
Parsed resource record (zero-copy view into a message). Stores the full message reference so type-specific rdata parsers can resolve compression pointers inside record data.
Implementations§
Source§impl<'a> Ref<'a>
impl<'a> Ref<'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 single resource record from message at offset.
Returns the record and the next offset to parse from.
Sourcepub const fn rtype(&self) -> ResourceType
pub const fn rtype(&self) -> ResourceType
Returns the resource record type.
Sourcepub const fn rclass(&self) -> ResourceClass
pub const fn rclass(&self) -> ResourceClass
Returns the resource record class.
Sourcepub const fn cache_flush(&self) -> bool
pub const fn cache_flush(&self) -> bool
Returns true if the mDNS cache-flush bit was set on this record.
Sourcepub fn rdata_view(&self) -> Result<Rdata<'a>, ParseError>
pub fn rdata_view(&self) -> Result<Rdata<'a>, ParseError>
Interpret this record’s rdata, dispatching by Self::rtype.
typed parsers now respect rdata_len so a malformed RDLENGTH cannot
let a name (PTR/SRV) consume bytes past its declared boundary, and
oversize A/AAAA rdata is rejected explicitly.
Trait Implementations§
impl<'a> Copy for Ref<'a>
impl<'a> Eq for Ref<'a>
impl<'a> StructuralPartialEq for Ref<'a>
Auto Trait Implementations§
impl<'a> Freeze for Ref<'a>
impl<'a> RefUnwindSafe for Ref<'a>
impl<'a> Send for Ref<'a>
impl<'a> Sync for Ref<'a>
impl<'a> Unpin for Ref<'a>
impl<'a> UnsafeUnpin for Ref<'a>
impl<'a> UnwindSafe for Ref<'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