pub struct OptimizedHttpConfig {
pub pool_max_idle_per_host: usize,
pub pool_idle_timeout: Duration,
pub connect_timeout: Duration,
pub request_timeout: Duration,
pub http2_prior_knowledge: bool,
pub http2_adaptive_window: bool,
pub gzip: bool,
pub brotli: bool,
pub user_agent: String,
}Expand description
HTTP客户端性能配置优化
Fields§
§pool_max_idle_per_host: usize连接池最大空闲连接数 (默认: 90)
pool_idle_timeout: Duration连接池空闲连接超时 (默认: 90秒)
connect_timeout: DurationTCP连接超时 (默认: 10秒)
request_timeout: Duration请求总超时 (默认: 30秒)
http2_prior_knowledge: bool启用HTTP/2 (默认: true)
http2_adaptive_window: boolHTTP/2自适应窗口 (默认: true)
gzip: bool启用gzip压缩 (默认: true)
brotli: bool启用brotli压缩 (默认: true)
user_agent: StringUser-Agent字符串
Implementations§
Source§impl OptimizedHttpConfig
impl OptimizedHttpConfig
Sourcepub fn production() -> Self
pub fn production() -> Self
创建生产环境优化配置
Sourcepub fn high_throughput() -> Self
pub fn high_throughput() -> Self
创建高吞吐量配置
Sourcepub fn low_latency() -> Self
pub fn low_latency() -> Self
创建低延迟配置
Sourcepub fn build_client(&self) -> Result<Client, Error>
pub fn build_client(&self) -> Result<Client, Error>
根据配置构建优化的HTTP客户端
Trait Implementations§
Source§impl Clone for OptimizedHttpConfig
impl Clone for OptimizedHttpConfig
Source§fn clone(&self) -> OptimizedHttpConfig
fn clone(&self) -> OptimizedHttpConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OptimizedHttpConfig
impl Debug for OptimizedHttpConfig
Auto Trait Implementations§
impl Freeze for OptimizedHttpConfig
impl RefUnwindSafe for OptimizedHttpConfig
impl Send for OptimizedHttpConfig
impl Sync for OptimizedHttpConfig
impl Unpin for OptimizedHttpConfig
impl UnwindSafe for OptimizedHttpConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more