Trait trust_dns_proto::xfer::DnsRequestSender [−][src]
pub trait DnsRequestSender: Stream<Item = Result<(), ProtoError>> + Send + Unpin + 'static {
type DnsResponseFuture: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin;
fn send_message<TE: Time>(
&mut self,
message: DnsRequest,
cx: &mut Context<'_>
) -> Self::DnsResponseFuture;
fn error_response<TE: Time>(error: ProtoError) -> Self::DnsResponseFuture;
fn shutdown(&mut self);
fn is_shutdown(&self) -> bool;
}
Expand description
Types that implement this are capable of sending a serialized DNS message on a stream
The underlying Stream implementation should yield Some(())
whenever it is ready to send a message,
NotReady, if it is not ready to send a message, and Err
or None
in the case that the stream is
done, and should be shutdown.
Associated Types
type DnsResponseFuture: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin
type DnsResponseFuture: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin
A future that resolves to a response serial message
Required methods
fn send_message<TE: Time>(
&mut self,
message: DnsRequest,
cx: &mut Context<'_>
) -> Self::DnsResponseFuture
fn send_message<TE: Time>(
&mut self,
message: DnsRequest,
cx: &mut Context<'_>
) -> Self::DnsResponseFuture
Send a message, and return a future of the response
Return
A future which will resolve to a SerialMessage response
fn error_response<TE: Time>(error: ProtoError) -> Self::DnsResponseFuture
fn error_response<TE: Time>(error: ProtoError) -> Self::DnsResponseFuture
Constructs an error response
Allows the upstream user to inform the underling stream that it should shutdown.
After this is called, the next time poll
is called on the stream it would be correct to return Poll::Ready(Ok(()))
. This is not required though, if there are say outstanding requests that are not yet complete, then it would be correct to first wait for those results.
fn is_shutdown(&self) -> bool
fn is_shutdown(&self) -> bool
Returns true if the stream has been shutdown with shutdown