Skip to content

Commit e31cf47

Browse files
committed
feat!: Change ConfigBuilder::timeout to accept Option<Duration>
1 parent b185259 commit e31cf47

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/client.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ mod tests {
448448
let now = Instant::now();
449449
let client = Client::from_config(
450450
&endpoint,
451-
crate::config::ConfigBuilder::new().timeout(Some(5)).build(),
451+
crate::config::ConfigBuilder::new()
452+
.timeout(Some(Duration::from_secs(5)))
453+
.build(),
452454
);
453455
let elapsed = now.elapsed();
454456

src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ impl ConfigBuilder {
5555
}
5656

5757
/// Sets the timeout
58-
pub fn timeout(mut self, timeout: Option<u8>) -> Self {
59-
self.config.timeout = timeout.map(|t| Duration::from_secs(t as u64));
58+
pub fn timeout(mut self, timeout: Option<Duration>) -> Self {
59+
self.config.timeout = timeout;
6060
self
6161
}
6262

0 commit comments

Comments
 (0)