pub trait Connection<B> {
type ResBody: Body + Send + 'static;
type Error: Error + Send + Sync + 'static;
type Future: Future<Output = Result<Response<Self::ResBody>, Self::Error>> + Send + 'static;
// Required methods
fn send_request(&mut self, request: Request<B>) -> Self::Future;
fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>;
fn version(&self) -> Version;
}
Available on crate feature
client
only.Expand description
A connection to a remote server which can send and recieve HTTP requests/responses.
Underneath, it may not use HTTP as the connection protocol, and it may use any appropriate transport protocol to connect to the server.
Required Associated Types§
Required Methods§
Sourcefn send_request(&mut self, request: Request<B>) -> Self::Future
fn send_request(&mut self, request: Request<B>) -> Self::Future
Send a request to the remote server and return the response.
Implementors§
Source§impl Connection<Body> for MockSender
Available on crate feature mocks
only.
impl Connection<Body> for MockSender
Available on crate feature
mocks
only.