pub struct ParsedRecord<Ref> { /* 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
sourceimpl<Ref> ParsedRecord<Ref>
impl<Ref> ParsedRecord<Ref>
sourcepub fn new(header: RecordHeader<ParsedDname<Ref>>, data: Parser<Ref>) -> Self
pub fn new(header: RecordHeader<ParsedDname<Ref>>, data: Parser<Ref>) -> 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<Ref>
pub fn owner(&self) -> &ParsedDname<Ref>
Returns a reference to the owner of the record.
sourceimpl<Ref: OctetsRef> ParsedRecord<Ref>
impl<Ref: OctetsRef> ParsedRecord<Ref>
sourcepub fn to_record<Data>(
&self
) -> Result<Option<Record<ParsedDname<Ref>, Data>>, ParseError>where
Data: ParseRecordData<Ref>,
pub fn to_record<Data>(
&self
) -> Result<Option<Record<ParsedDname<Ref>, Data>>, ParseError>where
Data: ParseRecordData<Ref>,
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<Ref>, Data>>, ParseError>where
Data: ParseRecordData<Ref>,
pub fn into_record<Data>(
self
) -> Result<Option<Record<ParsedDname<Ref>, Data>>, ParseError>where
Data: ParseRecordData<Ref>,
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
sourceimpl<Ref: Clone> Clone for ParsedRecord<Ref>
impl<Ref: Clone> Clone for ParsedRecord<Ref>
sourcefn clone(&self) -> ParsedRecord<Ref>
fn clone(&self) -> ParsedRecord<Ref>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<Ref: OctetsRef> Parse<Ref> for ParsedRecord<Ref>
impl<Ref: OctetsRef> Parse<Ref> for ParsedRecord<Ref>
sourceimpl<Ref, OtherRef> PartialEq<ParsedRecord<OtherRef>> for ParsedRecord<Ref>where
Ref: OctetsRef,
OtherRef: OctetsRef,
impl<Ref, OtherRef> PartialEq<ParsedRecord<OtherRef>> for ParsedRecord<Ref>where
Ref: OctetsRef,
OtherRef: OctetsRef,
sourcefn eq(&self, other: &ParsedRecord<OtherRef>) -> bool
fn eq(&self, other: &ParsedRecord<OtherRef>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl<Ref: OctetsRef> Eq for ParsedRecord<Ref>
Auto Trait Implementations
impl<Ref> RefUnwindSafe for ParsedRecord<Ref>where
Ref: RefUnwindSafe,
impl<Ref> Send for ParsedRecord<Ref>where
Ref: Send,
impl<Ref> Sync for ParsedRecord<Ref>where
Ref: Sync,
impl<Ref> Unpin for ParsedRecord<Ref>where
Ref: Unpin,
impl<Ref> UnwindSafe for ParsedRecord<Ref>where
Ref: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
sourcefn octets_into(self) -> Result<Target, ShortBuf>
fn octets_into(self) -> Result<Target, ShortBuf>
Performs the conversion.