[][src]Struct twitchchat::RetryStrategy

pub struct 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 with Ok(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]

impl Copy for RetryStrategy[src]

impl Debug for RetryStrategy[src]

impl Default for RetryStrategy[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.