pub trait Connection {
type Io: AsyncRead + AsyncWrite + Unpin;
type Future: Future<Output = Result<(ResponseHead, Payload), SendRequestError>>;
type TunnelFuture: Future<Output = Result<(ResponseHead, Framed<Self::Io, ClientCodec>), SendRequestError>>;
// Required methods
fn protocol(&self) -> Protocol;
fn send_request<B: MessageBody + 'static, H: Into<RequestHeadType>>(
self,
head: H,
body: B,
) -> Self::Future;
fn open_tunnel<H: Into<RequestHeadType>>(
self,
head: H,
) -> Self::TunnelFuture;
}Required Associated Types§
type Io: AsyncRead + AsyncWrite + Unpin
type Future: Future<Output = Result<(ResponseHead, Payload), SendRequestError>>
type TunnelFuture: Future<Output = Result<(ResponseHead, Framed<Self::Io, ClientCodec>), SendRequestError>>
Required Methods§
fn protocol(&self) -> Protocol
Sourcefn send_request<B: MessageBody + 'static, H: Into<RequestHeadType>>(
self,
head: H,
body: B,
) -> Self::Future
fn send_request<B: MessageBody + 'static, H: Into<RequestHeadType>>( self, head: H, body: B, ) -> Self::Future
Send request and body
Sourcefn open_tunnel<H: Into<RequestHeadType>>(self, head: H) -> Self::TunnelFuture
fn open_tunnel<H: Into<RequestHeadType>>(self, head: H) -> Self::TunnelFuture
Send request, returns Response and Framed
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.