Struct matrix_sdk::config::RequestConfig
source · pub struct RequestConfig { /* private fields */ }
Expand description
Configuration for requests the Client
makes.
This sets how often and for how long a request should be repeated. As well as how long a successful request is allowed to take.
By default requests are retried indefinitely and use no timeout.
§Examples
use matrix_sdk::config::RequestConfig;
use std::time::Duration;
// This sets makes requests fail after a single send request and sets the timeout to 30s
let request_config = RequestConfig::new()
.disable_retry()
.timeout(Duration::from_secs(30));
Implementations§
source§impl RequestConfig
impl RequestConfig
sourcepub fn short_retry() -> Self
pub fn short_retry() -> Self
Create a new RequestConfig
with default values, except the retry limit
which is set to 3.
sourcepub fn disable_retry(self) -> Self
pub fn disable_retry(self) -> Self
This is a convince method to disable the retries of a request. Setting
the retry_limit
to 0
has the same effect.
sourcepub fn retry_limit(self, retry_limit: u64) -> Self
pub fn retry_limit(self, retry_limit: u64) -> Self
The number of times a request should be retried. The default is no limit
sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set the timeout duration for all HTTP requests.
sourcepub fn retry_timeout(self, retry_timeout: Duration) -> Self
pub fn retry_timeout(self, retry_timeout: Duration) -> Self
Set a timeout for how long a request should be retried. The default is no timeout, meaning requests are retried forever.
sourcepub fn force_auth(self) -> Self
pub fn force_auth(self) -> Self
Force sending authorization even if the endpoint does not require it. Default is only sending authorization if it is required.
Trait Implementations§
source§impl Clone for RequestConfig
impl Clone for RequestConfig
source§fn clone(&self) -> RequestConfig
fn clone(&self) -> RequestConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for RequestConfig
Available on non-tarpaulin_include
only.
impl Debug for RequestConfig
tarpaulin_include
only.