From 767d417a09e9b6a79330f620b65ced26252f2e0f Mon Sep 17 00:00:00 2001 From: tison Date: Mon, 19 May 2025 12:01:44 +0800 Subject: [PATCH] chore: prepare for release 1.0 Signed-off-by: tison --- Cargo.lock | 2 +- fastpool/Cargo.toml | 2 +- fastpool/src/bounded.rs | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aede66f..0f4d14d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -176,7 +176,7 @@ dependencies = [ [[package]] name = "fastpool" -version = "0.4.2" +version = "1.0.0" dependencies = [ "mea", "scopeguard", diff --git a/fastpool/Cargo.toml b/fastpool/Cargo.toml index 26a14f8..82f62ee 100644 --- a/fastpool/Cargo.toml +++ b/fastpool/Cargo.toml @@ -16,7 +16,7 @@ name = "fastpool" description = "This crates implements a fast object pool for Async Rust." -version = "0.4.2" +version = "1.0.0" edition.workspace = true homepage.workspace = true diff --git a/fastpool/src/bounded.rs b/fastpool/src/bounded.rs index 3e3e521..799f055 100644 --- a/fastpool/src/bounded.rs +++ b/fastpool/src/bounded.rs @@ -195,9 +195,16 @@ impl Pool { }) } - /// Replenishes the pool with at most `most` number of new objects. + /// Replenishes the pool with at most `most` number of new objects: /// - /// Returns the number of objects that are actually replenished to the pool. + /// 1. If the pool has fewer slots to fill than `most`, narrow `most` to the number of slots. + /// 2. If there is already any idle object in the pool, decrease `most` by the number of idle + /// objects. + /// 3. If [`ManageObject::create`] returns `Err`, reduces `most` by 1 and continues to the next. + /// + /// Returns the number of objects that are actually replenished to the pool. This method is + /// suitable to implement functionalities like minimal idle connections in a connection + /// pool. pub async fn replenish(&self, most: usize) -> usize { let mut permit = { let mut n = most;