Struct Matcher

pub struct Matcher { /* private fields */ }

A proxy matcher, usually built from environment variables.

Implementations

impl Matcher

fn from_env() -> Self

Create a matcher reading the current environment variables.

This checks for values in the following variables, treating them the same as curl does:

  • ALL_PROXY/all_proxy
  • HTTPS_PROXY/https_proxy
  • HTTP_PROXY/http_proxy
  • NO_PROXY/no_proxy
fn from_system() -> Self

Create a matcher from the environment or system.

This checks the same environment variables as from_env(), and if not set, checks the system configuration for values for the OS.

This constructor is always available, but if the client-proxy-system feature is enabled, it will check more configuration. Use this constructor if you want to allow users to optionally enable more, or use from_env if you do not want the values to change based on an enabled feature.

fn builder() -> Builder

Start a builder to configure a matcher.

fn intercept(&self, dst: &Uri) -> Option<Intercept>

Check if the destination should be intercepted by a proxy.

If the proxy rules match the destination, a new Uri will be returned to connect to.

Trait Implementations

impl Debug for Matcher

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl !Freeze for Matcher

impl RefUnwindSafe for Matcher

impl Send for Matcher

impl Sync for Matcher

impl Unpin for Matcher

impl UnsafeUnpin for Matcher

impl UnwindSafe for Matcher

Blanket Implementations

impl<T> Any for Matcher where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Matcher where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Matcher where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for Matcher

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Matcher

impl<T> WithSubscriber for Matcher

impl<T, U> Into<U> for Matcher where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Matcher where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Matcher where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>