Trait HttpFetch

Source
pub trait HttpFetch:
    Send
    + Sync
    + Unpin
    + 'static {
    // Required method
    fn fetch(
        &self,
        req: Request<Buffer>,
    ) -> impl Future<Output = Result<Response<HttpBody>>> + MaybeSend;
}
Expand description

HttpFetch is the trait to fetch a request in async way. User should implement this trait to provide their own http client.

Required Methods§

Source

fn fetch( &self, req: Request<Buffer>, ) -> impl Future<Output = Result<Response<HttpBody>>> + MaybeSend

Fetch a request in async way.

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.

Implementations on Foreign Types§

Source§

impl HttpFetch for Client

Source§

async fn fetch(&self, req: Request<Buffer>) -> Result<Response<HttpBody>>

Source§

impl<T: HttpFetchDyn + ?Sized> HttpFetch for Arc<T>

Source§

async fn fetch(&self, req: Request<Buffer>) -> Result<Response<HttpBody>>

Implementors§