pub trait ParseRecordData<Ref>: RecordData {
    fn parse_data(
        rtype: Rtype,
        parser: &mut Parser<Ref>
    ) -> Result<Option<Self>, ParseError>; }
Expand description

A record data type that can be parsed from a message.

When record data types are generic – typically over a domain name type –, they may not in all cases be parseable. They may still represent record data to be used when constructing the message.

To reflect this asymmetry, parsing of record data has its own trait.

Required Methods

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 method 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 particual, it must not advance it.

Implementors