Skip to content

Commit a59b878

Browse files
committed
Bring DefaultSleeper into lib
1 parent 0d31bd8 commit a59b878

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/async.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ use log::{debug, error, info, trace};
2727

2828
use reqwest::{header, Client, Response};
2929

30-
use crate::sleeper::{DefaultSleeper, Sleeper};
30+
use crate::sleeper::Sleeper;
3131
use crate::{
32-
BlockStatus, BlockSummary, Builder, Error, MerkleProof, OutputStatus, Tx, TxStatus,
33-
BASE_BACKOFF_MILLIS, RETRYABLE_ERROR_CODES,
32+
BlockStatus, BlockSummary, Builder, DefaultSleeper, Error, MerkleProof, OutputStatus, Tx,
33+
TxStatus, BASE_BACKOFF_MILLIS, RETRYABLE_ERROR_CODES,
3434
};
3535

3636
#[derive(Debug, Clone)]

src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub use blocking::BlockingClient;
8686
#[cfg(feature = "async")]
8787
pub use r#async::AsyncClient;
8888
#[cfg(feature = "async")]
89-
use sleeper::{DefaultSleeper, Sleeper};
89+
use sleeper::Sleeper;
9090

9191
/// Response status codes for which the request may be retried.
9292
const RETRYABLE_ERROR_CODES: [u16; 3] = [
@@ -141,6 +141,9 @@ pub struct Builder<S = DefaultSleeper> {
141141
marker: PhantomData<S>,
142142
}
143143

144+
#[derive(Debug, Clone, Copy)]
145+
pub struct DefaultSleeper;
146+
144147
impl Builder {
145148
/// Instantiate a new builder
146149
pub fn new(base_url: &str) -> Self {

src/sleeper.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1+
use crate::DefaultSleeper;
12
use std::time::Duration;
23

34
#[async_trait::async_trait]
45
pub trait Sleeper {
56
async fn sleep(duration: Duration);
67
}
78

8-
#[derive(Debug, Clone, Copy)]
9-
pub struct DefaultSleeper;
10-
119
#[cfg(feature = "tokio")]
1210
#[async_trait::async_trait]
1311
impl Sleeper for DefaultSleeper {

0 commit comments

Comments
 (0)