domain::resolv::resolver

Trait Resolver

Source
pub trait Resolver {
    type Octets: AsRef<[u8]>;
    type Answer: AsRef<Message<Self::Octets>>;
    type Query: Future<Output = Result<Self::Answer, Error>> + Send;

    // Required method
    fn query<N, Q>(&self, question: Q) -> Self::Query
       where N: ToDname,
             Q: Into<Question<N>>;
}
Expand description

A type that acts as a DNS resolver.

A resolver is anything that tries to answer questions using the DNS. The query method takes a single question and returns a future that will eventually resolve into either an answer or an IO error.

Required Associated Types§

Source

type Octets: AsRef<[u8]>

Source

type Answer: AsRef<Message<Self::Octets>>

The answer returned by a query.

This isn’t Message directly as it may be useful for the resolver to provide additional information. For instance, a validating resolver (a resolver that checks whether DNSSEC signatures are correct) can supply more information as to why validation failed.

Source

type Query: Future<Output = Result<Self::Answer, Error>> + Send

The future resolving into an answer.

Required Methods§

Source

fn query<N, Q>(&self, question: Q) -> Self::Query
where N: ToDname, Q: Into<Question<N>>,

Returns a future answering a question.

The method takes anything that can be converted into a question and produces a future trying to answer the question.

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§