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
impl<N, R, A, E> Resolver<R> for ResolverThread<N, R, A, E> where R: Receiver<A, E>, N: Send, R: Send, A: Send, E: Send
impl<R, N, A> Resolver<R> for Mock<N, HashMap<N, A>> where R: Receiver<A, ()>, N: Hash + Eq, A: Clone
impl<R, N, A, E, F> Resolver<R> for Mock<N, F> where R: Receiver<A, E>, F: FnMut(N) -> Result<A, E>