Skip to main content

HttpClientBuilder

Struct HttpClientBuilder 

Source
pub struct HttpClientBuilder<S: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<S: State> HttpClientBuilder<S>

Source

pub fn build(self) -> Result<HttpClient, HttpClientError>
where S: IsComplete,

Finishes building and performs the requested action.

Source

pub fn headers( self, value: HashMap<String, String>, ) -> HttpClientBuilder<SetHeaders<S>>
where S::Headers: IsUnset,

Optional (Some / Option setters). Default: <HashMap<String, String> as Default>::default().

Source

pub fn maybe_headers( self, value: Option<HashMap<String, String>>, ) -> HttpClientBuilder<SetHeaders<S>>
where S::Headers: IsUnset,

Optional (Some / Option setters). Default: <HashMap<String, String> as Default>::default().

Source

pub fn header_keys( self, value: Vec<String>, ) -> HttpClientBuilder<SetHeaderKeys<S>>
where S::HeaderKeys: IsUnset,

Optional (Some / Option setters). Default: <Vec<String> as Default>::default().

Source

pub fn maybe_header_keys( self, value: Option<Vec<String>>, ) -> HttpClientBuilder<SetHeaderKeys<S>>
where S::HeaderKeys: IsUnset,

Optional (Some / Option setters). Default: <Vec<String> as Default>::default().

Source

pub fn keyed_quotas( self, value: Vec<(String, Quota)>, ) -> HttpClientBuilder<SetKeyedQuotas<S>>
where S::KeyedQuotas: IsUnset,

Optional (Some / Option setters). Default: <Vec<(String, Quota)> as Default>::default().

Source

pub fn maybe_keyed_quotas( self, value: Option<Vec<(String, Quota)>>, ) -> HttpClientBuilder<SetKeyedQuotas<S>>
where S::KeyedQuotas: IsUnset,

Optional (Some / Option setters). Default: <Vec<(String, Quota)> as Default>::default().

Source

pub fn default_quota( self, value: Quota, ) -> HttpClientBuilder<SetDefaultQuota<S>>
where S::DefaultQuota: IsUnset,

Optional (Some / Option setters).

Source

pub fn maybe_default_quota( self, value: Option<Quota>, ) -> HttpClientBuilder<SetDefaultQuota<S>>
where S::DefaultQuota: IsUnset,

Optional (Some / Option setters).

Source

pub fn timeout_secs(self, value: u64) -> HttpClientBuilder<SetTimeoutSecs<S>>
where S::TimeoutSecs: IsUnset,

Optional (Some / Option setters).

Source

pub fn maybe_timeout_secs( self, value: Option<u64>, ) -> HttpClientBuilder<SetTimeoutSecs<S>>
where S::TimeoutSecs: IsUnset,

Optional (Some / Option setters).

Source

pub fn proxy_url(self, value: String) -> HttpClientBuilder<SetProxyUrl<S>>
where S::ProxyUrl: IsUnset,

Optional (Some / Option setters).

Source

pub fn maybe_proxy_url( self, value: Option<String>, ) -> HttpClientBuilder<SetProxyUrl<S>>
where S::ProxyUrl: IsUnset,

Optional (Some / Option setters).

Source

pub fn rate_limiters( self, value: Vec<Arc<RateLimiter<Ustr, MonotonicClock>>>, ) -> HttpClientBuilder<SetRateLimiters<S>>
where S::RateLimiters: IsUnset,

Optional (Some / Option setters).

Source

pub fn maybe_rate_limiters( self, value: Option<Vec<Arc<RateLimiter<Ustr, MonotonicClock>>>>, ) -> HttpClientBuilder<SetRateLimiters<S>>
where S::RateLimiters: IsUnset,

Optional (Some / Option setters).

Source

pub fn redirect_policy( self, value: HttpRedirectPolicy, ) -> HttpClientBuilder<SetRedirectPolicy<S>>
where S::RedirectPolicy: IsUnset,

Optional (Some / Option setters). Default: <HttpRedirectPolicy as Default>::default().

Source

pub fn maybe_redirect_policy( self, value: Option<HttpRedirectPolicy>, ) -> HttpClientBuilder<SetRedirectPolicy<S>>
where S::RedirectPolicy: IsUnset,

Optional (Some / Option setters). Default: <HttpRedirectPolicy as Default>::default().

Source

pub fn use_system_proxy( self, value: bool, ) -> HttpClientBuilder<SetUseSystemProxy<S>>
where S::UseSystemProxy: IsUnset,

Optional (Some / Option setters). Default: true.

Whether to honor ambient proxy configuration when proxy_url is not set.

Source

pub fn maybe_use_system_proxy( self, value: Option<bool>, ) -> HttpClientBuilder<SetUseSystemProxy<S>>
where S::UseSystemProxy: IsUnset,

Optional (Some / Option setters). Default: true.

Whether to honor ambient proxy configuration when proxy_url is not set.

Source

pub fn redact_url(self, value: bool) -> HttpClientBuilder<SetRedactUrl<S>>
where S::RedactUrl: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to omit the request origin added by this client to transport errors and response-stream diagnostics. Defaults to false. Userinfo, paths, queries, and fragments are always excluded from the added URL context. Diagnostic messages from lower layers are unchanged. TLS certificate errors and dependency logs can still include the hostname.

Source

pub fn maybe_redact_url( self, value: Option<bool>, ) -> HttpClientBuilder<SetRedactUrl<S>>
where S::RedactUrl: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to omit the request origin added by this client to transport errors and response-stream diagnostics. Defaults to false. Userinfo, paths, queries, and fragments are always excluded from the added URL context. Diagnostic messages from lower layers are unchanged. TLS certificate errors and dependency logs can still include the hostname.

Auto Trait Implementations§

§

impl<S = Empty> !RefUnwindSafe for HttpClientBuilder<S>

§

impl<S = Empty> !UnwindSafe for HttpClientBuilder<S>

§

impl<S> Freeze for HttpClientBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<HttpClient>)>: Freeze,

§

impl<S> Send for HttpClientBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<HttpClient>)>: Send,

§

impl<S> Sync for HttpClientBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<HttpClient>)>: Sync,

§

impl<S> Unpin for HttpClientBuilder<S>
where PhantomData<(fn() -> S, fn() -> PhantomData<HttpClient>)>: Unpin,

§

impl<S> UnsafeUnpin for HttpClientBuilder<S>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

Source§

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> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
§

impl<T> Ungil for T
where T: Send,

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more