#[non_exhaustive]pub enum WinHttpPacSource {
AutoDetect,
Url(Url),
AutoDetectThenUrl(Url),
}Available on Windows and crate feature
pac-windows-native and crate feature pac only.Expand description
Where WinHTTP looks for the PAC script (WINHTTP_AUTOPROXY_OPTIONS, not a body).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
AutoDetect
WPAD: DHCP option 252, then wpad.<domain>. Miss → not an error
(WinHttpPacResolver::resolve). Needs WinHttpPacResolver::with_wpad.
Url(Url)
Explicit PAC URL (ProxyMode::Pac).
AutoDetectThenUrl(Url)
WPAD first, then URL: Windows “auto-detect + script” both ticked. Needs
WinHttpPacResolver::with_wpad.
ProxyMode is single-valued; WinHttpPacResolver::resolve_config rebuilds
this for ProxyMode::WpadAutoDetect by re-reading the registry.
Implementations§
Source§impl WinHttpPacSource
impl WinHttpPacSource
Sourcepub fn from_mode(mode: &ProxyMode) -> Option<Self>
pub fn from_mode(mode: &ProxyMode) -> Option<Self>
ProxyMode::Pac → Url, WpadAutoDetect
→ AutoDetect; PacInline → None.
use proxy_watch::pac::WinHttpPacSource;
use proxy_watch::{ProxyMode, Url};
let mode = ProxyMode::pac(Url::parse("http://wpad.corp/proxy.pac").unwrap());
assert!(matches!(WinHttpPacSource::from_mode(&mode), Some(WinHttpPacSource::Url(_))));
assert_eq!(
WinHttpPacSource::from_mode(&ProxyMode::WpadAutoDetect),
Some(WinHttpPacSource::AutoDetect)
);
assert_eq!(WinHttpPacSource::from_mode(&ProxyMode::Direct), None);Trait Implementations§
Source§impl Clone for WinHttpPacSource
impl Clone for WinHttpPacSource
Source§impl Debug for WinHttpPacSource
impl Debug for WinHttpPacSource
impl Eq for WinHttpPacSource
Source§impl PartialEq for WinHttpPacSource
impl PartialEq for WinHttpPacSource
impl StructuralPartialEq for WinHttpPacSource
Auto Trait Implementations§
impl Freeze for WinHttpPacSource
impl RefUnwindSafe for WinHttpPacSource
impl Send for WinHttpPacSource
impl Sync for WinHttpPacSource
impl Unpin for WinHttpPacSource
impl UnsafeUnpin for WinHttpPacSource
impl UnwindSafe for WinHttpPacSource
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