pub trait Resolver: DynClone + Debug + Sync + Send {
    // Required method
    fn resolve(
        &self,
        domain: &str,
        opts: ResolveOptions<'_>
    ) -> Result<ResolveAnswers, Error>;

    // Provided method
    fn async_resolve<'a>(
        &'a self,
        domain: &'a str,
        opts: ResolveOptions<'a>
    ) -> Pin<Box<dyn Future<Output = Result<ResolveAnswers, Error>> + Send + 'a, Global>> { ... }
}
Expand description

域名解析的接口

同时提供阻塞接口和异步接口,异步接口则需要启用 async 功能

Required Methods§

fn resolve( &self, domain: &str, opts: ResolveOptions<'_> ) -> Result<ResolveAnswers, Error>

解析域名

该方法的异步版本为 Self::async_resolve

Provided Methods§

fn async_resolve<'a>( &'a self, domain: &'a str, opts: ResolveOptions<'a> ) -> Pin<Box<dyn Future<Output = Result<ResolveAnswers, Error>> + Send + 'a, Global>>

异步解析域名

Implementations on Foreign Types§

§

impl<T> Resolver for Box<T, Global>where T: Resolver + ?Sized, Box<T, Global>: DynClone + Debug + Sync + Send,

§

fn resolve( &self, domain: &str, opts: ResolveOptions<'_> ) -> Result<ResolveAnswers, Error>

§

fn async_resolve<'a>( &'a self, domain: &'a str, opts: ResolveOptions<'a> ) -> Pin<Box<dyn Future<Output = Result<ResolveAnswers, Error>> + Send + 'a, Global>>

§

impl<'b, T> Resolver for &'b Twhere T: 'b + Resolver + ?Sized, &'b T: DynClone + Debug + Sync + Send,

§

fn resolve( &self, domain: &str, opts: ResolveOptions<'_> ) -> Result<ResolveAnswers, Error>

§

fn async_resolve<'a>( &'a self, domain: &'a str, opts: ResolveOptions<'a> ) -> Pin<Box<dyn Future<Output = Result<ResolveAnswers, Error>> + Send + 'a, Global>>

§

impl<'b, T> Resolver for &'b mut Twhere T: 'b + Resolver + ?Sized, &'b mut T: DynClone + Debug + Sync + Send,

§

fn resolve( &self, domain: &str, opts: ResolveOptions<'_> ) -> Result<ResolveAnswers, Error>

§

fn async_resolve<'a>( &'a self, domain: &'a str, opts: ResolveOptions<'a> ) -> Pin<Box<dyn Future<Output = Result<ResolveAnswers, Error>> + Send + 'a, Global>>

§

impl<T> Resolver for Arc<T>where T: Resolver + ?Sized, Arc<T>: DynClone + Debug + Sync + Send,

§

fn resolve( &self, domain: &str, opts: ResolveOptions<'_> ) -> Result<ResolveAnswers, Error>

§

fn async_resolve<'a>( &'a self, domain: &'a str, opts: ResolveOptions<'a> ) -> Pin<Box<dyn Future<Output = Result<ResolveAnswers, Error>> + Send + 'a, Global>>

§

impl<T> Resolver for Rc<T>where T: Resolver + ?Sized, Rc<T>: DynClone + Debug + Sync + Send,

§

fn resolve( &self, domain: &str, opts: ResolveOptions<'_> ) -> Result<ResolveAnswers, Error>

§

fn async_resolve<'a>( &'a self, domain: &'a str, opts: ResolveOptions<'a> ) -> Pin<Box<dyn Future<Output = Result<ResolveAnswers, Error>> + Send + 'a, Global>>

Implementors§

§

impl Resolver for CAresResolver

§

impl Resolver for ChainedResolver

§

impl Resolver for SimpleResolver

§

impl Resolver for TrustDnsResolver

§

impl<R> Resolver for CachedResolver<R>where R: Resolver + 'static,

§

impl<R> Resolver for ShuffledResolver<R>where R: Resolver + Clone,

§

impl<R> Resolver for TimeoutResolver<R>where R: Resolver + Clone + 'static,