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 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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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