Struct domain::base::record::ParsedRecord
source · pub struct ParsedRecord<'a, Octs: Octets + ?Sized> { /* private fields */ }
Expand description
A raw record parsed from a message.
A value of this type contains the record header and the raw record data.
It is mainly used as an intermediary type when turning raw message data
into Record
s.
It allows access to the header only but can be traded for a real record
of a specific type of ParseRecordData
(i.e., some type that knowns
how to parse record data) via the to_record
and into_record
methods.
Implementations§
source§impl<'a, Octs: Octets + ?Sized> ParsedRecord<'a, Octs>
impl<'a, Octs: Octets + ?Sized> ParsedRecord<'a, Octs>
sourcepub fn new(
header: RecordHeader<ParsedDname<&'a Octs>>,
data: Parser<'a, Octs>,
) -> Self
pub fn new( header: RecordHeader<ParsedDname<&'a Octs>>, data: Parser<'a, Octs>, ) -> Self
Creates a new parsed record from a header and the record data.
The record data is provided via a parser that is positioned at the first byte of the record data.
sourcepub fn owner(&self) -> ParsedDname<&'a Octs>
pub fn owner(&self) -> ParsedDname<&'a Octs>
Returns a reference to the owner of the record.
source§impl<'a, Octs: Octets + ?Sized> ParsedRecord<'a, Octs>
impl<'a, Octs: Octets + ?Sized> ParsedRecord<'a, Octs>
sourcepub fn to_record<Data>(
&self,
) -> Result<Option<Record<ParsedDname<Octs::Range<'_>>, Data>>, ParseError>where
Data: ParseRecordData<'a, Octs>,
pub fn to_record<Data>(
&self,
) -> Result<Option<Record<ParsedDname<Octs::Range<'_>>, Data>>, ParseError>where
Data: ParseRecordData<'a, Octs>,
Creates a real resource record from the parsed record.
The method is generic over a type that knows how to parse record
data via the ParseRecordData
trait. The record data is given to
this trait for parsing. If the trait feels capable of parsing this
type of record (as indicated by the record type) and parsing succeeds,
the method returns Ok(Some(_))
. It returns Ok(None)
if the trait
doesn’t know how to parse this particular record type. It returns
an error if parsing fails.
sourcepub fn into_record<Data>(
self,
) -> Result<Option<Record<ParsedDname<Octs::Range<'a>>, Data>>, ParseError>where
Data: ParseRecordData<'a, Octs>,
pub fn into_record<Data>(
self,
) -> Result<Option<Record<ParsedDname<Octs::Range<'a>>, Data>>, ParseError>where
Data: ParseRecordData<'a, Octs>,
Trades the parsed record for a real resource record.
The method is generic over a type that knows how to parse record
data via the ParseRecordData
trait. The record data is given to
this trait for parsing. If the trait feels capable of parsing this
type of record (as indicated by the record type) and parsing succeeds,
the method returns Ok(Some(_))
. It returns Ok(None)
if the trait
doesn’t know how to parse this particular record type. It returns
an error if parsing fails.
Trait Implementations§
source§impl<'a, Octs: Clone + Octets + ?Sized> Clone for ParsedRecord<'a, Octs>
impl<'a, Octs: Clone + Octets + ?Sized> Clone for ParsedRecord<'a, Octs>
source§fn clone(&self) -> ParsedRecord<'a, Octs>
fn clone(&self) -> ParsedRecord<'a, Octs>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a, 'o, Octs, Other> PartialEq<ParsedRecord<'o, Other>> for ParsedRecord<'a, Octs>
impl<'a, 'o, Octs, Other> PartialEq<ParsedRecord<'o, Other>> for ParsedRecord<'a, Octs>
impl<'a, Octs: Octets + ?Sized> Eq for ParsedRecord<'a, Octs>
Auto Trait Implementations§
impl<'a, Octs> Freeze for ParsedRecord<'a, Octs>where
Octs: ?Sized,
impl<'a, Octs> RefUnwindSafe for ParsedRecord<'a, Octs>where
Octs: RefUnwindSafe + ?Sized,
impl<'a, Octs> Send for ParsedRecord<'a, Octs>
impl<'a, Octs> Sync for ParsedRecord<'a, Octs>
impl<'a, Octs> Unpin for ParsedRecord<'a, Octs>where
Octs: ?Sized,
impl<'a, Octs> UnwindSafe for ParsedRecord<'a, Octs>where
Octs: RefUnwindSafe + ?Sized,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)