Skip to main content

TxtRecordParser

Trait TxtRecordParser 

Source
pub trait TxtRecordParser: Sized {
    // Required method
    fn parse(record: &[u8]) -> Result<Self>;

    // Provided method
    fn parse_records(records: &[Vec<u8>]) -> Result<Self> { ... }
}
Expand description

Parser for a record type published in DNS TXT records.

Implemented by every record type that MessageAuthenticator::txt_lookup can fetch.

Required Methods§

Source

fn parse(record: &[u8]) -> Result<Self>

Parses the contents of one TXT record, with its character strings already concatenated.

§Errors

Returns Error::Dns with DnsError::InvalidRecordType when the record is not of this type (for example, a missing or wrong version tag), or another Error when the record is of this type but malformed.

Provided Methods§

Source

fn parse_records(records: &[Vec<u8>]) -> Result<Self>

Parses the TXT records found at one name, each with its character strings already concatenated. The default implementation returns the first record that parse accepts, or the error of the last one.

§Errors

Returns Error::Dns with DnsError::InvalidRecordType when records is empty, or the error of the last record otherwise.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§