pub enum ProxyConfig {
Simple(LitStr),
Full {
proxy_type: Option<ProxyType>,
url: LitStr,
username: Option<LitStr>,
password: Option<LitStr>,
no_proxy: Option<LitStr>,
},
Disabled(LitBool),
}Expand description
代理配置结构
支持多种代理配置方式:
- 简单 URL 形式:proxy = “http://proxy.example.com:8080”
- 指定类型形式:proxy(type = http, url = “proxy.example.com:8080”)
- 完整配置形式:proxy(type = socks5, url = “…”, username = “…”, password = “…”)
- 禁用代理:proxy = false
Variants§
Implementations§
Source§impl ProxyConfig
impl ProxyConfig
Sourcepub fn proxy_type(&self) -> Option<&ProxyType>
pub fn proxy_type(&self) -> Option<&ProxyType>
获取代理类型
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
是否明确禁用代理
Sourcepub fn infer_proxy_type(&self) -> Option<ProxyType>
pub fn infer_proxy_type(&self) -> Option<ProxyType>
推断代理类型(从 URL 或显式配置)
Trait Implementations§
Source§impl Clone for ProxyConfig
impl Clone for ProxyConfig
Source§fn clone(&self) -> ProxyConfig
fn clone(&self) -> ProxyConfig
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 moreAuto Trait Implementations§
impl Freeze for ProxyConfig
impl RefUnwindSafe for ProxyConfig
impl !Send for ProxyConfig
impl !Sync for ProxyConfig
impl Unpin for ProxyConfig
impl UnwindSafe for ProxyConfig
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