Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched to Into<Option<T>> for parameters in Builder #185

Merged
merged 2 commits into from
Jan 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions bb8/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@
///
/// Defaults to None.
#[must_use]
pub fn min_idle(mut self, min_idle: Option<u32>) -> Self {
self.min_idle = min_idle;
pub fn min_idle(mut self, min_idle: impl Into<Option<u32>>) -> Self {
self.min_idle = min_idle.into();
self
}

Expand Down Expand Up @@ -194,7 +194,8 @@
///
/// Will panic if `max_lifetime` is 0.
#[must_use]
pub fn max_lifetime(mut self, max_lifetime: Option<Duration>) -> Self {
pub fn max_lifetime(mut self, max_lifetime: impl Into<Option<Duration>>) -> Self {
let max_lifetime = max_lifetime.into();
assert_ne!(
max_lifetime,
Some(Duration::from_secs(0)),
Expand All @@ -215,7 +216,8 @@
///
/// Will panic if `idle_timeout` is 0.
#[must_use]
pub fn idle_timeout(mut self, idle_timeout: Option<Duration>) -> Self {
pub fn idle_timeout(mut self, idle_timeout: impl Into<Option<Duration>>) -> Self {
let idle_timeout = idle_timeout.into();

Check warning on line 220 in bb8/src/api.rs

View check run for this annotation

Codecov / codecov/patch

bb8/src/api.rs#L219-L220

Added lines #L219 - L220 were not covered by tests
assert_ne!(
idle_timeout,
Some(Duration::from_secs(0)),
Expand Down
Loading