pub struct TimeoutConfig {
    pub api: Api,
    pub http: Http,
    pub tcp: Tcp,
}
Expand description

Top-level configuration for timeouts

Example


use aws_smithy_types::{timeout, tristate::TriState};

let api_timeouts = timeout::Api::new()
    .with_call_timeout(TriState::Set(Duration::from_secs(2)))
    .with_call_attempt_timeout(TriState::Set(Duration::from_secs_f32(0.5)));
let timeout_config = timeout::Config::new()
    .with_api_timeouts(api_timeouts);

assert_eq!(
    timeout_config.api.call_timeout(),
    TriState::Set(Duration::from_secs(2))
);

assert_eq!(
    timeout_config.api.call_attempt_timeout(),
    TriState::Set(Duration::from_secs_f32(0.5))
);

Fields

api: Api

API timeouts used by Smithy Clients

http: Http

HTTP timeouts used by DynConnectors

tcp: Tcp

TCP timeouts used by lower-level DynConnectors

Implementations

Create a new Config with no timeouts set

Return the API-related timeouts from this config

Return the API-related timeouts from this config

Return the API-related timeouts from this config

Consume an Config to create a new one, setting the API-related timeouts

Consume a Config to create a new one, setting HTTP-related timeouts

Consume a Config to create a new one, setting TCP-related timeouts

Merges two timeout configs together.

Values from other will only be used as a fallback for values from self. Useful for merging configs from different sources together when you want to handle “precedence” per value instead of at the config level

Example
let a = timeout::Config::new().with_api_timeouts(
    timeout::Api::new().with_call_timeout(TriState::Set(Duration::from_secs(2)))
);
let b = timeout::Config::new().with_api_timeouts(
    timeout::Api::new().with_call_attempt_timeout(TriState::Set(Duration::from_secs(3)))
);
let timeout_config = a.take_unset_from(b);
// A's value take precedence over B's value
assert_eq!(timeout_config.api.call_timeout(), TriState::Set(Duration::from_secs(2)));
// A never set a connect timeout so B's value was used
assert_eq!(timeout_config.api.call_attempt_timeout(), TriState::Set(Duration::from_secs(3)));

Returns true if any of the possible timeouts are set

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more