[−][src]Struct twitchchat::RetryStrategy
Some common retry strategies.
These are used with [Runner::run_with_retry
][retry].
You can provide your own by simplying having an async function with the same signature.
That is async fn(result: Result<Status, Error>) -> Result<bool, Error>
.
Return one of:
Ok(true)
to cause it to reconnect.Ok(false)
will gracefully exit withOk(Status::Eof)
Err(err)
will return that error
Implementations
impl RetryStrategy
[src]
pub async fn immediately(result: Result<Status, Error>) -> Result<bool, Error>
[src]
This is supported on
feature="tokio"
only.Reconnect immediately unless the Status
was Canceled
pub async fn on_timeout(result: Result<Status, Error>) -> Result<bool, Error>
[src]
This is supported on
feature="tokio"
only.Retries if Status
was a Timeout, otherwise return the Err
or false
(to stop the connection loop).
pub async fn on_error(result: Result<Status, Error>) -> Result<bool, Error>
[src]
This is supported on
feature="tokio"
only.Retries if the Result
was an error
Trait Implementations
impl Clone for RetryStrategy
[src]
fn clone(&self) -> RetryStrategy
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for RetryStrategy
[src]
impl Debug for RetryStrategy
[src]
impl Default for RetryStrategy
[src]
fn default() -> RetryStrategy
[src]
Auto Trait Implementations
impl RefUnwindSafe for RetryStrategy
impl Send for RetryStrategy
impl Sync for RetryStrategy
impl Unpin for RetryStrategy
impl UnwindSafe for RetryStrategy
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,