pub struct ParsedRecord { /* 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 Records.
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 ParsedRecord
impl ParsedRecord
Sourcepub fn new(header: RecordHeader<ParsedDname>, data: Parser) -> Self
pub fn new(header: RecordHeader<ParsedDname>, data: Parser) -> 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
pub fn owner(&self) -> &ParsedDname
Returns a reference to the owner of the record.
Source§impl ParsedRecord
impl ParsedRecord
Sourcepub fn to_record<D>(
&self,
) -> Result<Option<Record<ParsedDname, D>>, RecordParseError<ParsedDnameError, D::Err>>where
D: ParseRecordData,
pub fn to_record<D>(
&self,
) -> Result<Option<Record<ParsedDname, D>>, RecordParseError<ParsedDnameError, D::Err>>where
D: ParseRecordData,
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<D>(
self,
) -> Result<Option<Record<ParsedDname, D>>, RecordParseError<ParsedDnameError, D::Err>>where
D: ParseRecordData,
pub fn into_record<D>(
self,
) -> Result<Option<Record<ParsedDname, D>>, RecordParseError<ParsedDnameError, D::Err>>where
D: ParseRecordData,
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 Clone for ParsedRecord
impl Clone for ParsedRecord
Source§fn clone(&self) -> ParsedRecord
fn clone(&self) -> ParsedRecord
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more