Skip to main content

HttpService

Trait HttpService 

Source
pub trait HttpService:
    Debug
    + Send
    + Sync
    + 'static {
    // Required method
    fn call(
        &self,
        request: Request,
    ) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + '_>>;
}
Expand description

An abstraction over HTTP request execution.

This trait allows decoupling request building (which uses reqwest::RequestBuilder) from request execution. The primary use case is SpawnService, which spawns execution on a dedicated I/O runtime – useful when the CPU runtime has I/O disabled.

Required Methods§

Source

fn call( &self, request: Request, ) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + '_>>

Execute an HTTP request, returning the response.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§