[][src]Trait domain_core::bits::rdata::ParseRecordData

pub trait ParseRecordData: RecordData {
    type Err: Fail;
    fn parse_data(
        rtype: Rtype,
        parser: &mut Parser,
        rdlen: usize
    ) -> Result<Option<Self>, Self::Err>; }

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.

Associated Types

type Err: Fail

The type of an error returned when parsing fails.

Loading content...

Required methods

fn parse_data(
    rtype: Rtype,
    parser: &mut Parser,
    rdlen: usize
) -> Result<Option<Self>, Self::Err>

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 data is rdlen bytes long and starts at the current position of parser. There is no guarantee that the parser will have rdlen bytes left. If it doesn’t, the function should produce an error.

If the function doesn’t want to process the data, it must not touch the parser. In particual, it must not advance it.

Loading content...

Implementors

impl ParseRecordData for AllRecordData<ParsedDname>[src]

type Err = AllDataParseError

impl ParseRecordData for MasterRecordData<ParsedDname>[src]

type Err = MasterDataParseError

impl ParseRecordData for UnknownRecordData[src]

type Err = ShortBuf

impl<T: RtypeRecordData + ParseAll + Compose + Compress + Sized> ParseRecordData for T[src]

type Err = Self::Err

Loading content...