Trait Policy

Source
pub trait Policy<Response> {
    // Required method
    fn decide(&mut self, response: &Response) -> Decision;

    // Provided method
    fn retry<Request, S>(
        self,
        stream: S,
        request: Request,
    ) -> impl Future<Output = S::Response> + Send
       where Response: Send,
             Request: Clone + Send,
             S: Stream<Request, Response = Response> + Send,
             <S as Stream<Request>>::Function: Send,
             Self: Sized + Send { ... }
}

Required Methods§

Source

fn decide(&mut self, response: &Response) -> Decision

Provided Methods§

Source

fn retry<Request, S>( self, stream: S, request: Request, ) -> impl Future<Output = S::Response> + Send
where Response: Send, Request: Clone + Send, S: Stream<Request, Response = Response> + Send, <S as Stream<Request>>::Function: Send, Self: Sized + Send,

Implementors§

Source§

impl<Response> Policy<Response> for Once

Source§

impl<Response, Error> Policy<Result<Response, Error>> for RetryOnError