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

Returns true if any of the possible timeouts are set

Create a new TimeoutConfig with no timeouts set

A limit on the amount of time after making an initial connect attempt on a socket to complete the connect-handshake.

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.

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.

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.

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.

Consume a TimeoutConfig to create a new one, setting the connect timeout

Consume a TimeoutConfig to create a new one, setting the TLS negotiation timeout

Consume a TimeoutConfig to create a new one, setting the read timeout

Consume a TimeoutConfig to create a new one, setting the API call attempt timeout

Consume a TimeoutConfig to create a new one, setting the API call timeout

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

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 !=.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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