Trait abstract_ns::Resolver [] [src]

pub trait Resolver<R: Receiver<Self::Address, Self::Error>> {
    type Name;
    type Address;
    type Error;
    fn request(&mut self, name: Self::Name, dest: R);
}

A traits that encapsulates name resolution

If your're implementing a name service you should implement this trait.

Associated Types

type Name

The name that can be resolved via this name service. Note in many cases type should implement Send

type Address

The value of the address returned back

type Error

Error that name resolver can return

Required Methods

fn request(&mut self, name: Self::Name, dest: R)

The method which does name resolution

When name resolution is done, you should use dest.result(x) to deliver result.

This trait is inherently asynchronous. For synchronous (blocking) implementations you should use BlockingResolver. This gives clear indicator for user that process may be slow, so they can offload it to thread if needed.

Implementors