Struct aws_config::TimeoutConfig
source · [−]pub struct TimeoutConfig { /* private fields */ }
Expand description
Configuration for timeouts
Example
use aws_smithy_types::timeout::TimeoutConfig;
let timeout_config = TimeoutConfig::new()
.with_api_call_timeout(Some(Duration::from_secs(2)))
.with_api_call_attempt_timeout(Some(Duration::from_secs_f32(0.5)));
assert_eq!(
timeout_config.api_call_timeout(),
Some(Duration::from_secs(2))
);
assert_eq!(
timeout_config.api_call_attempt_timeout(),
Some(Duration::from_secs_f32(0.5))
);
Implementations
sourceimpl TimeoutConfig
impl TimeoutConfig
sourcepub fn has_timeouts(&self) -> bool
pub fn has_timeouts(&self) -> bool
Returns true if any of the possible timeouts are set
sourceimpl TimeoutConfig
impl TimeoutConfig
sourcepub fn new() -> TimeoutConfig
pub fn new() -> TimeoutConfig
Create a new TimeoutConfig
with no timeouts set
sourcepub fn connect_timeout(&self) -> Option<Duration>
pub fn connect_timeout(&self) -> Option<Duration>
A limit on the amount of time after making an initial connect attempt on a socket to complete the connect-handshake.
sourcepub fn tls_negotiation_timeout(&self) -> Option<Duration>
pub fn tls_negotiation_timeout(&self) -> Option<Duration>
A limit on the amount of time a TLS handshake takes from when the CLIENT HELLO
message is
sent to the time the client and server have fully negotiated ciphers and exchanged keys.
sourcepub fn read_timeout(&self) -> Option<Duration>
pub fn read_timeout(&self) -> Option<Duration>
A limit on the amount of time an application takes to attempt to read the first byte over an established, open connection after write request. This is also known as the “time to first byte” timeout.
sourcepub fn api_call_attempt_timeout(&self) -> Option<Duration>
pub fn api_call_attempt_timeout(&self) -> Option<Duration>
A limit on the amount of time it takes for the first byte to be sent over an established,
open connection and when the last byte is received from the service for a single attempt.
If you want to set a timeout for an entire request including retry attempts,
use TimeoutConfig::api_call_timeout
instead.
sourcepub fn api_call_timeout(&self) -> Option<Duration>
pub fn api_call_timeout(&self) -> Option<Duration>
A limit on the amount of time it takes for request to complete. A single request may be
comprised of several attemps depending on an app’s RetryConfig
. If you want
to control timeouts for a single attempt, use TimeoutConfig::api_call_attempt_timeout
.
sourcepub fn with_connect_timeout(self, timeout: Option<Duration>) -> TimeoutConfig
pub fn with_connect_timeout(self, timeout: Option<Duration>) -> TimeoutConfig
Consume a TimeoutConfig
to create a new one, setting the connect timeout
sourcepub fn with_tls_negotiation_timeout(
self,
timeout: Option<Duration>
) -> TimeoutConfig
pub fn with_tls_negotiation_timeout(
self,
timeout: Option<Duration>
) -> TimeoutConfig
Consume a TimeoutConfig
to create a new one, setting the TLS negotiation timeout
sourcepub fn with_read_timeout(self, timeout: Option<Duration>) -> TimeoutConfig
pub fn with_read_timeout(self, timeout: Option<Duration>) -> TimeoutConfig
Consume a TimeoutConfig
to create a new one, setting the read timeout
sourcepub fn with_api_call_attempt_timeout(
self,
timeout: Option<Duration>
) -> TimeoutConfig
pub fn with_api_call_attempt_timeout(
self,
timeout: Option<Duration>
) -> TimeoutConfig
Consume a TimeoutConfig
to create a new one, setting the API call attempt timeout
sourcepub fn with_api_call_timeout(self, timeout: Option<Duration>) -> TimeoutConfig
pub fn with_api_call_timeout(self, timeout: Option<Duration>) -> TimeoutConfig
Consume a TimeoutConfig
to create a new one, setting the API call timeout
sourcepub fn take_unset_from(self, other: TimeoutConfig) -> TimeoutConfig
pub fn take_unset_from(self, other: TimeoutConfig) -> TimeoutConfig
Merges two builders 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 = TimeoutConfig::new().with_read_timeout(Some(Duration::from_secs(2)));
let b = TimeoutConfig::new()
.with_read_timeout(Some(Duration::from_secs(10)))
.with_connect_timeout(Some(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.read_timeout(), Some(Duration::from_secs(2)));
// A never set a connect timeout so B's value was used
assert_eq!(timeout_config.connect_timeout(), Some(Duration::from_secs(3)));
Trait Implementations
sourceimpl Clone for TimeoutConfig
impl Clone for TimeoutConfig
sourcepub fn clone(&self) -> TimeoutConfig
pub fn clone(&self) -> TimeoutConfig
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for TimeoutConfig
impl Debug for TimeoutConfig
sourceimpl Default for TimeoutConfig
impl Default for TimeoutConfig
sourcepub fn default() -> TimeoutConfig
pub fn default() -> TimeoutConfig
Returns the “default value” for a type. Read more
sourceimpl PartialEq<TimeoutConfig> for TimeoutConfig
impl PartialEq<TimeoutConfig> for TimeoutConfig
sourcepub fn eq(&self, other: &TimeoutConfig) -> bool
pub fn eq(&self, other: &TimeoutConfig) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcepub fn ne(&self, other: &TimeoutConfig) -> bool
pub fn ne(&self, other: &TimeoutConfig) -> bool
This method tests for !=
.
impl StructuralPartialEq for TimeoutConfig
Auto Trait Implementations
impl RefUnwindSafe for TimeoutConfig
impl Send for TimeoutConfig
impl Sync for TimeoutConfig
impl Unpin for TimeoutConfig
impl UnwindSafe for TimeoutConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
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