[][src]Struct domain_resolv::stub::resolver::StubResolver

pub struct StubResolver(_);

A DNS stub resolver.

This type collects all information making it possible to start DNS queries. You can create a new resoler using the system’s configuration using the new() associate function or using your own configuration with from_conf().

Stub resolver values can be cloned relatively cheaply as they keep all information behind an arc.

If you want to run a single query or lookup on a resolver synchronously, you can do so simply by using the run() or run_with_conf() associated functions.

Methods

impl StubResolver[src]

pub fn new() -> Self[src]

Creates a new resolver using the system’s default configuration.

pub fn from_conf(conf: ResolvConf) -> Self[src]

Creates a new resolver using the given configuraiton.

pub fn options(&self) -> &ResolvOptions[src]

impl StubResolver[src]

pub fn run<R, F>(op: F) -> Result<R::Item, R::Error> where
    R: Future + Send + 'static,
    R::Item: Send + 'static,
    R::Error: Send + 'static,
    F: FnOnce(StubResolver) -> R + Send + 'static, 
[src]

Synchronously perform a DNS operation atop a standard resolver.

This associated functions removes almost all boiler plate for the case that you want to perform some DNS operation, either a query or lookup, on a resolver using the system’s configuration and wait for the result.

The only argument is a closure taking a reference to a StubResolver and returning a future. Whatever that future resolves to will be returned.

pub fn run_with_conf<R, F>(conf: ResolvConf, op: F) -> Result<R::Item, R::Error> where
    R: Future + Send + 'static,
    R::Item: Send + 'static,
    R::Error: Send + 'static,
    F: FnOnce(StubResolver) -> R + Send + 'static, 
[src]

Synchronously perform a DNS operation atop a configured resolver.

This is like run() but also takes a resolver configuration for tailor-making your own resolver.

Trait Implementations

impl Resolver for StubResolver[src]

type Answer = Answer

The answer returned by a query. Read more

type Query = Query

The future resolving into an answer.

fn lookup_addr(&self, addr: IpAddr) -> LookupAddr<Self> where
    Self: Sized
[src]

fn lookup_host<N: ToDname>(&self, name: &N) -> LookupHost<Self> where
    Self: Sized
[src]

fn search_host<N>(self, name: N) -> SearchHost<Self, N> where
    Self: Sized + SearchNames,
    N: ToRelativeDname
[src]

fn lookup_srv<S, N>(
    self,
    service: S,
    name: N,
    fallback_port: u16
) -> LookupSrv<Self, S, N> where
    Self: Sized,
    S: ToRelativeDname + Clone + Send + 'static,
    N: ToDname + Send + 'static, 
[src]

impl SearchNames for StubResolver[src]

type Iter = SearchIter

impl Clone for StubResolver[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for StubResolver[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Erased for T