-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Xuanwo <github@xuanwo.io>
- Loading branch information
Showing
13 changed files
with
109 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
use std::fmt::Debug; | ||
use std::time::Duration; | ||
|
||
/// BackoffBuilder is used to build a new backoff. | ||
/// BackoffBuilder is utilized to construct a new backoff. | ||
pub trait BackoffBuilder: Debug + Send + Sync + Unpin { | ||
/// The associated backoff that returned by this builder. | ||
/// The associated backoff returned by this builder. | ||
type Backoff: Backoff; | ||
|
||
/// Builder a new backoff via builder. | ||
/// Construct a new backoff using the builder. | ||
fn build(self) -> Self::Backoff; | ||
} | ||
|
||
/// Backoff is an [`Iterator`] that returns [`Duration`]. | ||
/// | ||
/// - `Some(Duration)` means caller need to `sleep(Duration)` and retry the same request | ||
/// - `None` means we have reaching the limits, caller needs to return current error instead. | ||
/// - `Some(Duration)` indicates the caller should `sleep(Duration)` and retry the request. | ||
/// - `None` indicates the limits have been reached, and the caller should return the current error instead. | ||
pub trait Backoff: Iterator<Item = Duration> + Send + Sync + Unpin {} | ||
impl<T> Backoff for T where T: Iterator<Item = Duration> + Debug + Send + Sync + Unpin {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
//! Docs for the backon crate, like examples. | ||
//! Docs for the backon crate, like [`examples`]. | ||
|
||
pub mod examples; |
Oops, something went wrong.