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

pub struct AsyncClient { /* fields omitted */ }
Expand description

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[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>>

Notable traits for AsyncClientConnect<F, S>

impl<F, S> Future for AsyncClientConnect<F, S> where
    F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
    S: DnsRequestSender + 'static + Send + Unpin
type Output = Result<(AsyncClient, DnsExchangeBackground<S, 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>>

Notable traits for AsyncClientConnect<F, S>

impl<F, S> Future for AsyncClientConnect<F, S> where
    F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
    S: DnsRequestSender + 'static + Send + Unpin
type Output = Result<(AsyncClient, DnsExchangeBackground<S, 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 AsyncClient[src]

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

Notable traits for AsyncClientConnect<F, S>

impl<F, S> Future for AsyncClientConnect<F, S> where
    F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
    S: DnsRequestSender + 'static + Send + Unpin
type Output = Result<(AsyncClient, DnsExchangeBackground<S, TokioTime>), ProtoError>;
where
    S: DnsRequestSender,
    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 Clone for AsyncClient[src]

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl DnsHandle for AsyncClient[src]

type Response = DnsExchangeSend

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

type Error = ProtoError

Error of the response, generally this will be ProtoError

fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(
    &mut self,
    request: R
) -> Self::Response
[src]

Send a message via the channel in the client Read more

fn is_verifying_dnssec(&self) -> bool[src]

Only returns true if and only if this DNS handle is validating DNSSec. Read more

fn lookup(&mut self, query: Query, options: DnsRequestOptions) -> Self::Response[src]

A classic DNS query Read more

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V