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 max_concurrent_requests(self, limit: Option<NonZeroUsize>) -> Self
pub fn max_concurrent_requests(self, limit: Option<NonZeroUsize>) -> Self
The total limit of request that are pending or run concurrently. Any additional request beyond that number will be waiting until another concurrent requests finished. Requests are queued fairly.
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
impl Debug for RequestConfig
Source§impl Default for RequestConfig
impl Default for RequestConfig
impl Copy for RequestConfig
Auto Trait Implementations§
impl Freeze for RequestConfig
impl RefUnwindSafe for RequestConfig
impl Send for RequestConfig
impl Sync for RequestConfig
impl Unpin for RequestConfig
impl UnwindSafe for RequestConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more