Trait mio_surf::HttpClient[][src]

pub trait HttpClient: 'static + Send + Sync + Unpin + Debug {
#[must_use]    pub fn send<'life0, 'async_trait>(
        &'life0 self,
        req: Request
    ) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + 'async_trait + Send, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }

An abstract HTTP client.

note that this is only exposed for use in middleware. Building new backing clients is not recommended yet. Once it is we'll likely publish a new http_client crate, and re-export this trait from there together with all existing HTTP client implementations.

Spawning new request from middleware

When threading the trait through a layer of middleware, the middleware must be able to perform new requests. In order to enable this efficiently an HttpClient instance may want to be passed though middleware for one of its own requests, and in order to do so should be wrapped in an Rc/Arc to enable reference cloning.

Required methods

#[must_use]pub fn send<'life0, 'async_trait>(
    &'life0 self,
    req: Request
) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + 'async_trait + Send, Global>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Perform a request.

Loading content...

Implementations on Foreign Types

impl HttpClient for IsahcClient[src]

impl HttpClient for Box<dyn HttpClient + 'static, Global>[src]

Loading content...

Implementors

Loading content...