Struct ClientBuilder

Source
pub struct ClientBuilder { /* private fields */ }

Implementations§

Source§

impl ClientBuilder

Source

pub fn default_headers(self, val: HeaderMap) -> Self

Sets default headers that will be applied to all requests made through this http. These headers can be overridden by request-specific headers.

Source

pub fn disable_connection_pool(self) -> Self

Disables the connection pooling feature. When disabled, a new connection will be created for each request.

Source

pub fn max_idle_connections(self, val: usize) -> Self

Sets the maximum number of idle connections that can be kept in the connection pool. Once this limit is reached, older idle connections will be dropped. Applicable on feature pool, pool-hyper or pool-native-tls only

Source

pub fn idle_connection_timeout(self, val: u64) -> Self

Sets the duration after which an idle connection in the pool will be closed. The timeout is specified in seconds. Applicable on feature pool, pool-hyper or pool-native-tls only

Source

pub fn set_read_timeout(self, val: u64) -> Self

Sets the read timeout for the HTTP/1.1 connections, has no effect on HTTP/2 connections After this duration elapses without receiving any data, the read operation will fail. The timeout value is specified in seconds.

Source

pub fn initial_max_streams(self, val: usize) -> Self

Sets the initial maximum number of streams that can be created when a new HTTP/2 connection is established. This value affects the initial stream capacity allocation and can be adjusted based on expected concurrent requests.

Source

pub fn max_concurrent_streams(self, val: u32) -> Self

Sets the maximum number of concurrent HTTP/2 streams allowed per connection. Default is 100. Higher values allow more parallel requests on a single connection, but may require more memory and processing resources.

Source

pub fn http1_only(self) -> Self

Forces the http to use HTTP/1.1 protocol only, disabling HTTP/2 support. Useful when you need to ensure HTTP/1.1 compatibility.

Source

pub fn http2_prior_knowledge(self) -> Self

Enables HTTP/2 prior knowledge mode, assuming all connections will use HTTP/2. This skips the HTTP/1.1 -> HTTP/2 upgrade process.

Source

pub fn enable_https(self) -> Self

Enables HTTPS/TLS support for secure connections. Must be called to make HTTPS requests.

Source§

impl ClientBuilder

Source

pub fn build(self) -> MonoioClient

Trait Implementations§

Source§

impl Default for ClientBuilder

Source§

fn default() -> ClientBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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