#[non_exhaustive]
pub struct Config { pub http_keep_alive: bool, pub tcp_no_delay: bool, pub timeout: Option<Duration>, pub max_connections_per_host: usize, pub tls_config: Option<Arc<ClientConfig>>, }
Expand description

Configuration for HttpClients.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§http_keep_alive: bool

HTTP/1.1 keep-alive (connection pooling).

Default: true.

Note: Does nothing on wasm_client.

§tcp_no_delay: bool

TCP NO_DELAY.

Default: false.

Note: Does nothing on wasm_client.

§timeout: Option<Duration>

Connection timeout duration.

Default: Some(Duration::from_secs(60)).

§max_connections_per_host: usize

Maximum number of simultaneous connections that this client is allowed to keep open to individual hosts at one time.

Default: 50. This number is based on a few random benchmarks and see whatever gave decent perf vs resource use in Orogene.

Note: The behavior of this is different depending on the backend in use.

  • h1_client: 0 is disallowed and asserts as otherwise it would cause a semaphore deadlock.
  • curl_client: 0 allows for limitless connections per host.
  • hyper_client: No effect. Hyper does not support such an option.
  • wasm_client: No effect. Web browsers do not support such an option.
§tls_config: Option<Arc<ClientConfig>>

TLS Configuration (Rustls)

Implementations§

source§

impl Config

source

pub fn new() -> Self

Construct new empty config.

source§

impl Config

source

pub fn set_http_keep_alive(self, keep_alive: bool) -> Self

Set HTTP/1.1 keep-alive (connection pooling).

source

pub fn set_tcp_no_delay(self, no_delay: bool) -> Self

Set TCP NO_DELAY.

source

pub fn set_timeout(self, timeout: Option<Duration>) -> Self

Set connection timeout duration.

source

pub fn set_max_connections_per_host( self, max_connections_per_host: usize ) -> Self

Set the maximum number of simultaneous connections that this client is allowed to keep open to individual hosts at one time.

source

pub fn set_tls_config(self, tls_config: Option<Arc<ClientConfig>>) -> Self

Set TLS Configuration (Rustls)

Trait Implementations§

source§

impl AsRef<Config> for Config

source§

fn as_ref(&self) -> &HttpConfig

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Config

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Config

source§

fn default() -> Self

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

impl From<Config> for Config

source§

fn from(http_config: HttpConfig) -> Self

Converts to this type from the input type.
source§

impl TryFrom<Config> for H1Client

§

type Error = Infallible

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

fn try_from(config: Config) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl !UnwindSafe for Config

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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, U> Into<U> for Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V