From 2c2c72ef0cac645aebb0c7ac36233bc520249cbf Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 8 Feb 2023 15:14:48 +0800 Subject: [PATCH] feat: Allow clone on backoff builder Signed-off-by: Xuanwo --- src/backoff.rs | 2 +- src/constant.rs | 2 +- src/exponential.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backoff.rs b/src/backoff.rs index e16a63f..2a34abc 100644 --- a/src/backoff.rs +++ b/src/backoff.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use std::time::Duration; /// BackoffBuilder is used to build a new backoff. -pub trait BackoffBuilder: Default + Debug + Send + Sync + Unpin { +pub trait BackoffBuilder: Clone + Debug + Send + Sync + Unpin { /// The associated backoff that returned by this builder. type Backoff: Backoff; diff --git a/src/constant.rs b/src/constant.rs index 7063ffe..1f8b524 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -31,7 +31,7 @@ use crate::backoff::BackoffBuilder; /// Ok(()) /// } /// ``` -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct ConstantBuilder { delay: Duration, max_times: Option, diff --git a/src/exponential.rs b/src/exponential.rs index bf949d7..4081c7a 100644 --- a/src/exponential.rs +++ b/src/exponential.rs @@ -36,7 +36,7 @@ use crate::backoff::BackoffBuilder; /// Ok(()) /// } /// ``` -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct ExponentialBuilder { jitter: bool, factor: f32,