pub trait HttpClient: Send + Sync {
// Required method
fn execute<'life0, 'async_trait>(
&'life0 self,
request: Request<Vec<u8>>,
) -> Pin<Box<dyn Future<Output = Result<Response<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
定义 HTTP 客户端行为的 Trait。
可根据爱好替换底层的 HTTP 实现。
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl HttpClient for ReqwestHttpClient
基于 reqwest 库的默认 HTTP 客户端实现。