pub trait ParseRecordData<'a, Octs: ?Sized>: RecordData + Sized {
// Required method
fn parse_rdata(
rtype: Rtype,
parser: &mut Parser<'a, Octs>,
) -> Result<Option<Self>, ParseError>;
}
Expand description
A record data type that can be parsed from a message.
This trait allows a record data type to express whether it is able to
parse record data for a specific record type. It is thus implemented by
all record data types included in the rdata
module.
Required Methods§
sourcefn parse_rdata(
rtype: Rtype,
parser: &mut Parser<'a, Octs>,
) -> Result<Option<Self>, ParseError>
fn parse_rdata( rtype: Rtype, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>
Parses the record data.
The record data is for a record of type rtype
. The function may
decide whether it wants to parse data for that type. It should return
Ok(None)
if it doesn’t.
The parser
is positioned at the beginning of the record data and is
is limited to the length of the data. The function only needs to parse
as much data as it needs. The caller has to make sure to deal with
data remaining in the parser.
If the function doesn’t want to process the data, it must not touch the parser. In particular, it must not advance it.