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.
Example
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
sourceimpl 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
sourceimpl Clone for RequestConfig
impl Clone for RequestConfig
sourcefn clone(&self) -> RequestConfig
fn clone(&self) -> RequestConfig
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 RequestConfig
Available on non-tarpaulin_include
only.
impl Debug for RequestConfig
tarpaulin_include
only.sourceimpl Default for RequestConfig
impl Default for RequestConfig
impl Copy for RequestConfig
Auto Trait Implementations
impl RefUnwindSafe for RequestConfig
impl Send for RequestConfig
impl Sync for RequestConfig
impl Unpin for RequestConfig
impl UnwindSafe for RequestConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
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>
impl<T> Pointable for T
impl<T> Pointable for T
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.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
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