Trait ParseRecordData

Source
pub trait ParseRecordData: RecordData {
    type Err: Fail;

    // Required method
    fn parse_data(
        rtype: Rtype,
        parser: &mut Parser,
        rdlen: usize,
    ) -> Result<Option<Self>, Self::Err>;
}
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 Associated Types§

Source

type Err: Fail

The type of an error returned when parsing fails.

Required Methods§

Source

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§