Struct aws_config::timeout::Config
source · [−]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 Client
s
http: Http
HTTP timeouts used by DynConnector
s
tcp: Tcp
TCP timeouts used by lower-level DynConnector
s
Implementations
sourceimpl Config
impl Config
sourcepub fn api_timeouts(&self) -> Api
pub fn api_timeouts(&self) -> Api
Return the API-related timeouts from this config
sourcepub fn http_timeouts(&self) -> Http
pub fn http_timeouts(&self) -> Http
Return the API-related timeouts from this config
sourcepub fn tcp_timeouts(&self) -> Tcp
pub fn tcp_timeouts(&self) -> Tcp
Return the API-related timeouts from this config
sourcepub fn with_api_timeouts(self, timeouts: Api) -> Config
pub fn with_api_timeouts(self, timeouts: Api) -> Config
Consume an Config
to create a new one, setting the API-related timeouts
sourcepub fn with_http_timeouts(self, timeouts: Http) -> Config
pub fn with_http_timeouts(self, timeouts: Http) -> Config
Consume a Config
to create a new one, setting HTTP-related timeouts
sourcepub fn with_tcp_timeouts(self, timeouts: Tcp) -> Config
pub fn with_tcp_timeouts(self, timeouts: Tcp) -> Config
Consume a Config
to create a new one, setting TCP-related timeouts
sourcepub fn take_unset_from(self, other: Config) -> Config
pub fn take_unset_from(self, other: Config) -> Config
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)));
sourcepub fn has_timeouts(&self) -> bool
pub fn has_timeouts(&self) -> bool
Returns true if any of the possible timeouts are set