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 se
Trait Implementations
impl StructuralPartialEq for Config
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more