pub trait Lookup: Send + Sync {
    fn lookup_a<'lookup, 'a, 'async_trait>(
        &'lookup self,
        name: &'a Name
    ) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Ipv4Addr>>> + Send + 'async_trait>>
    where
        'lookup: 'async_trait,
        'a: 'async_trait,
        Self: 'async_trait
; fn lookup_aaaa<'lookup, 'a, 'async_trait>(
        &'lookup self,
        name: &'a Name
    ) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Ipv6Addr>>> + Send + 'async_trait>>
    where
        'lookup: 'async_trait,
        'a: 'async_trait,
        Self: 'async_trait
; fn lookup_mx<'lookup, 'a, 'async_trait>(
        &'lookup self,
        name: &'a Name
    ) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Name>>> + Send + 'async_trait>>
    where
        'lookup: 'async_trait,
        'a: 'async_trait,
        Self: 'async_trait
; fn lookup_txt<'lookup, 'a, 'async_trait>(
        &'lookup self,
        name: &'a Name
    ) -> Pin<Box<dyn Future<Output = LookupResult<Vec<String>>> + Send + 'async_trait>>
    where
        'lookup: 'async_trait,
        'a: 'async_trait,
        Self: 'async_trait
; fn lookup_ptr<'lookup, 'async_trait>(
        &'lookup self,
        ip: IpAddr
    ) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Name>>> + Send + 'async_trait>>
    where
        'lookup: 'async_trait,
        Self: 'async_trait
; }
Expand description

A trait for entities that perform DNS resolution.

This trait uses the Name type in arguments and return values. See the documentation of this type for a discussion of its design and use.

An implementation of this trait for the Trust-DNS TokioAsyncResolver is available when the feature trust-dns-resolver is enabled.

Lookup is not a general purpose DNS resolver. It is a simplistic ad-hoc model for performing DNS resolution as used in the SPF protocol.

Required Methods

Looks up the IPv4 addresses for the given name.

Errors

If the lookup encounters an error, a LookupError variant is returned.

Looks up the IPv6 addresses for the given name.

Errors

If the lookup encounters an error, a LookupError variant is returned.

Looks up the mail exchanger names for the given name.

Implementers may want to order the returned vector by MX preference.

Errors

If the lookup encounters an error, a LookupError variant is returned.

Looks up the text records for the given name.

Implementers should make sure that invalid UTF-8 does not cause the lookup to fail (eg, using a lossy transformation). A record consisting of multiple elements should be returned as one string, with elements joined without a separator.

Errors

If the lookup encounters an error, a LookupError variant is returned.

Looks up the names for the given address (reverse lookup).

Errors

If the lookup encounters an error, a LookupError variant is returned.

Implementations on Foreign Types

Implementors