rama_http/layer/retry/
layer.rs1use super::Retry;
2use rama_core::Layer;
3
4#[derive(Debug, Clone)]
6pub struct RetryLayer<P> {
7 policy: P,
8}
9
10impl<P> RetryLayer<P> {
11 pub const fn new(policy: P) -> Self {
13 Self { policy }
14 }
15}
16
17impl<P, S> Layer<S> for RetryLayer<P>
18where
19 P: Clone,
20{
21 type Service = Retry<P, S>;
22
23 fn layer(&self, service: S) -> Self::Service {
24 Retry::new(self.policy.clone(), service)
25 }
26
27 fn into_layer(self, service: S) -> Self::Service {
28 Retry::new(self.policy, service)
29 }
30}