pub trait HttpCaller:
Debug
+ Send
+ Sync {
// Required methods
fn call(
&self,
request: &mut Request<'_, RequestBody<'_>>,
) -> Result<Response<ResponseBody>, Error>;
fn async_call<'a>(
&'a self,
request: &'a mut Request<'_, AsyncRequestBody<'_>>,
) -> Pin<Box<dyn Future<Output = Result<Response<AsyncResponseBody>, Error>> + Send + 'a>>;
// Provided methods
fn is_resolved_ip_addrs_supported(&self) -> bool { ... }
fn is_response_metrics_supported(&self) -> bool { ... }
}
Expand description
HTTP 请求处理接口
实现该接口,即可处理所有七牛 SDK 发送的 HTTP 请求
Required Methods§
Sourcefn call(
&self,
request: &mut Request<'_, RequestBody<'_>>,
) -> Result<Response<ResponseBody>, Error>
fn call( &self, request: &mut Request<'_, RequestBody<'_>>, ) -> Result<Response<ResponseBody>, Error>
阻塞发送 HTTP 请求
该方法的异步版本为 Self::async_call
。
Sourcefn async_call<'a>(
&'a self,
request: &'a mut Request<'_, AsyncRequestBody<'_>>,
) -> Pin<Box<dyn Future<Output = Result<Response<AsyncResponseBody>, Error>> + Send + 'a>>
fn async_call<'a>( &'a self, request: &'a mut Request<'_, AsyncRequestBody<'_>>, ) -> Pin<Box<dyn Future<Output = Result<Response<AsyncResponseBody>, Error>> + Send + 'a>>
异步发送 HTTP 请求
Provided Methods§
Sourcefn is_resolved_ip_addrs_supported(&self) -> bool
fn is_resolved_ip_addrs_supported(&self) -> bool
是否实现了 IP 地址解析功能
Sourcefn is_response_metrics_supported(&self) -> bool
fn is_response_metrics_supported(&self) -> bool
是否返回响应指标信息功能