Skip to main content

Policy

Trait Policy 

Source
pub trait Policy<S: Service<St, Req>, St, Req>: Sized + Clone {
    // Required methods
    async fn retry(&mut self, req: &Req, res: &Result<S::Res, S::Error>) -> bool;
    fn clone_request(&self, req: &Req) -> Option<Req>;
}
Expand description

Determines whether and how a failed service call is retried.

Required Methods§

Source

async fn retry(&mut self, req: &Req, res: &Result<S::Res, S::Error>) -> bool

Returns whether the call should be retried.

Source

fn clone_request(&self, req: &Req) -> Option<Req>

Clones or reconstructs a request for a possible retry.

Returning None prevents retries for this request.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S, St, Req> Policy<S, St, Req> for DefaultRetryPolicy
where S: Service<St, Req>, Req: Clone,