#[non_exhaustive]pub struct ClientConfig {
pub endpoint: String,
pub timeout: Duration,
pub max_concurrent_requests: usize,
pub connect_timeout: Duration,
pub pool_idle_timeout: Duration,
pub pool_max_idle_per_host: usize,
pub tcp_keepalive: Option<Duration>,
pub signature_version: SignatureVersion,
/* private fields */
}Expand description
Configuration for the STS client.
Use ClientConfig::default() to create a new configuration,
then use the with_* methods to customize.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.endpoint: StringSTS API endpoint URL.
timeout: DurationHTTP request timeout.
max_concurrent_requests: usizeMaximum number of concurrent API requests.
connect_timeout: DurationConnection timeout for establishing TCP connections.
pool_idle_timeout: DurationPool idle timeout before closing idle connections.
pool_max_idle_per_host: usizeMaximum number of idle connections per host.
tcp_keepalive: Option<Duration>TCP keepalive duration.
signature_version: SignatureVersionSignature version to use for API requests.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
Creates a new configuration with a custom endpoint.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sourcepub fn with_max_concurrent_requests(self, max: usize) -> Self
pub fn with_max_concurrent_requests(self, max: usize) -> Self
Sets the maximum number of concurrent API requests.
This limit helps prevent overwhelming the server and manages resource usage. When the limit is reached, additional requests will wait until a slot becomes available.
§Arguments
max- Maximum number of concurrent requests (must be > 0)
§Panics
Panics if max is 0.
§Example
let config = ClientConfig::default().with_max_concurrent_requests(5);Sourcepub fn with_connect_timeout(self, timeout: Duration) -> Self
pub fn with_connect_timeout(self, timeout: Duration) -> Self
Sets the connection timeout for establishing TCP connections.
Sourcepub fn with_pool_idle_timeout(self, timeout: Duration) -> Self
pub fn with_pool_idle_timeout(self, timeout: Duration) -> Self
Sets the pool idle timeout before closing idle connections.
Sourcepub fn with_pool_max_idle_per_host(self, max: usize) -> Self
pub fn with_pool_max_idle_per_host(self, max: usize) -> Self
Sets the maximum number of idle connections per host.
Sourcepub fn with_tcp_keepalive(self, duration: Option<Duration>) -> Self
pub fn with_tcp_keepalive(self, duration: Option<Duration>) -> Self
Sets the TCP keepalive duration. Use None to disable.
Sourcepub fn with_signature_version(self, version: SignatureVersion) -> Self
pub fn with_signature_version(self, version: SignatureVersion) -> Self
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more