BackoffLayer

Struct BackoffLayer 

Source
pub struct BackoffLayer<P, B> { /* private fields */ }
Expand description

A layer that creates a service that will attempt & reattempt to perform a service call based on a policy.

Each subsequent call will have a backoff period as defined by the passed strategy

Implementations§

Source§

impl<P, B> BackoffLayer<P, B>

Source

pub fn new(policy: P, backoff_strategy: B) -> Self

Trait Implementations§

Source§

impl<S, P, B> Layer<S> for BackoffLayer<P, B>
where P: Clone, B: Clone,

Source§

type Service = BackoffService<P, S, B>

The wrapped service
Source§

fn layer(&self, inner: S) -> Self::Service

Wrap the given service with the middleware, returning a new service that has been decorated with the middleware.

Auto Trait Implementations§

§

impl<P, B> Freeze for BackoffLayer<P, B>
where B: Freeze, P: Freeze,

§

impl<P, B> RefUnwindSafe for BackoffLayer<P, B>

§

impl<P, B> Send for BackoffLayer<P, B>
where B: Send, P: Send,

§

impl<P, B> Sync for BackoffLayer<P, B>
where B: Sync, P: Sync,

§

impl<P, B> Unpin for BackoffLayer<P, B>
where B: Unpin, P: Unpin,

§

impl<P, B> UnwindSafe for BackoffLayer<P, B>
where B: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.