Trait hickory_resolver::name_server::RuntimeProvider

source ·
pub trait RuntimeProvider: Clone + Send + Sync + Unpin + 'static {
    type Handle: Clone + Send + Spawn + Sync + Unpin;
    type Timer: Time + Send + Unpin;
    type Udp: DnsUdpSocket + QuicLocalAddr + Send;
    type Tcp: DnsTcpStream;

    // Required methods
    fn create_handle(&self) -> Self::Handle;
    fn connect_tcp(
        &self,
        server_addr: SocketAddr
    ) -> Pin<Box<dyn Send + Future<Output = Result<Self::Tcp>>>>;
    fn bind_udp(
        &self,
        local_addr: SocketAddr,
        server_addr: SocketAddr
    ) -> Pin<Box<dyn Send + Future<Output = Result<Self::Udp>>>>;
}
Expand description

RuntimeProvider defines which async runtime that handles IO and timers.

Required Associated Types§

source

type Handle: Clone + Send + Spawn + Sync + Unpin

Handle to the executor;

source

type Timer: Time + Send + Unpin

Timer

source

type Udp: DnsUdpSocket + QuicLocalAddr + Send

UdpSocket, where QuicLocalAddr is for quinn crate.

source

type Tcp: DnsTcpStream

TcpStream

Required Methods§

source

fn create_handle(&self) -> Self::Handle

Create a runtime handle

source

fn connect_tcp( &self, server_addr: SocketAddr ) -> Pin<Box<dyn Send + Future<Output = Result<Self::Tcp>>>>

Create a TCP connection with custom configuration.

source

fn bind_udp( &self, local_addr: SocketAddr, server_addr: SocketAddr ) -> Pin<Box<dyn Send + Future<Output = Result<Self::Udp>>>>

Create a UDP socket bound to local_addr. The returned value should not be connected to server_addr. Notice: the future should be ready once returned at best effort. Otherwise UDP DNS may need much more retries.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl RuntimeProvider for TokioRuntimeProvider

Available on crate feature tokio-runtime only.
§

type Handle = TokioHandle

§

type Timer = TokioTime

§

type Udp = UdpSocket

§

type Tcp = AsyncIoTokioAsStd<TcpStream>