[][src]Struct trust_dns_client::client::AsyncClient

pub struct AsyncClient<R> where
    R: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin
{ /* fields omitted */ }

A DNS Client implemented over futures-rs.

This Client is generic and capable of wrapping UDP, TCP, and other underlying DNS protocol implementations.

Implementations

impl AsyncClient<DnsMultiplexerSerialResponse>[src]

pub fn new<F, S>(
    stream: F,
    stream_handle: Box<dyn DnsStreamHandle>,
    signer: Option<Arc<Signer>>
) -> AsyncClientConnect<DnsMultiplexerConnect<F, S, Signer>, DnsMultiplexer<S, Signer>, DnsMultiplexerSerialResponse>

Notable traits for AsyncClientConnect<F, S, R>

impl<F, S, R> Future for AsyncClientConnect<F, S, R> where
    F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
    S: DnsRequestSender<DnsResponseFuture = R> + 'static + Send + Unpin,
    R: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin
type Output = Result<(AsyncClient<R>, DnsExchangeBackground<S, R, TokioTime>), ProtoError>;
where
    F: Future<Output = Result<S, ProtoError>> + Send + Unpin + 'static,
    S: DnsClientStream + Unpin + 'static, 
[src]

Spawns a new AsyncClient Stream. This uses a default timeout of 5 seconds for all requests.

Arguments

  • stream - A stream of bytes that can be used to send/receive DNS messages (see TcpClientStream or UdpClientStream)
  • stream_handle - The handle for the stream on which bytes can be sent/received.
  • signer - An optional signer for requests, needed for Updates with Sig0, otherwise not needed

pub fn with_timeout<F, S>(
    stream: F,
    stream_handle: Box<dyn DnsStreamHandle>,
    timeout_duration: Duration,
    signer: Option<Arc<Signer>>
) -> AsyncClientConnect<DnsMultiplexerConnect<F, S, Signer>, DnsMultiplexer<S, Signer>, DnsMultiplexerSerialResponse>

Notable traits for AsyncClientConnect<F, S, R>

impl<F, S, R> Future for AsyncClientConnect<F, S, R> where
    F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
    S: DnsRequestSender<DnsResponseFuture = R> + 'static + Send + Unpin,
    R: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin
type Output = Result<(AsyncClient<R>, DnsExchangeBackground<S, R, TokioTime>), ProtoError>;
where
    F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
    S: DnsClientStream + Unpin + 'static, 
[src]

Spawns a new AsyncClient Stream.

Arguments

  • stream - A stream of bytes that can be used to send/receive DNS messages (see TcpClientStream or UdpClientStream)
  • timeout_duration - All requests may fail due to lack of response, this is the time to wait for a response before canceling the request.
  • stream_handle - The handle for the stream on which bytes can be sent/received.
  • signer - An optional signer for requests, needed for Updates with Sig0, otherwise not needed

impl<R> AsyncClient<R> where
    R: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin
[src]

pub fn connect<F, S>(connect_future: F) -> AsyncClientConnect<F, S, R>

Notable traits for AsyncClientConnect<F, S, R>

impl<F, S, R> Future for AsyncClientConnect<F, S, R> where
    F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
    S: DnsRequestSender<DnsResponseFuture = R> + 'static + Send + Unpin,
    R: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin
type Output = Result<(AsyncClient<R>, DnsExchangeBackground<S, R, TokioTime>), ProtoError>;
where
    S: DnsRequestSender<DnsResponseFuture = R>,
    F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin
[src]

Returns a future, which itself wraps a future which is awaiting connection.

The connect_future should be lazy.

Returns

This returns a tuple of Self a handle to send dns messages and an optional background. The background task must be run on an executor before handle is used, if it is Some. If it is None, then another thread has already run the background.

Trait Implementations

impl<R> Clone for AsyncClient<R> where
    R: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin
[src]

impl<Resp> DnsHandle for AsyncClient<Resp> where
    Resp: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin
[src]

type Response = DnsExchangeSend<Resp>

The associated response from the response future, this should resolve to the Response message

Auto Trait Implementations

impl<R> !RefUnwindSafe for AsyncClient<R>

impl<R> Send for AsyncClient<R>

impl<R> Sync for AsyncClient<R>

impl<R> Unpin for AsyncClient<R>

impl<R> !UnwindSafe for AsyncClient<R>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,