//! Middleware for retrying "failed" requests. pub mod budget; pub mod future; mod layer; mod policy; pub use self::layer::RetryLayer; pub use self::policy::Policy; use self::future::ResponseFuture; use pin_project_lite::pin_project; use std::task::{Context, Poll}; use tower_service::Service; pin_project! { /// Configure retrying requests of "failed" responses. /// /// A [`Policy`] classifies what is a "failed" response. #[derive(Clone, Debug)] pub struct Retry
{ #[pin] policy: P, service: S, } } // ===== impl Retry ===== impl
Retry
{ /// Retry the inner service depending on this [`Policy`]. pub fn new(policy: P, service: S) -> Self { Retry { policy, service } } /// Get a reference to the inner service pub fn get_ref(&self) -> &S { &self.service } /// Get a mutable reference to the inner service pub fn get_mut(&mut self) -> &mut S { &mut self.service } /// Consume `self`, returning the inner service pub fn into_inner(self) -> S { self.service } } impl
Service
where
P: Policy ;
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll