Index: Cargo.toml ================================================================== --- Cargo.toml +++ Cargo.toml @@ -1,8 +1,8 @@ [package] name = "bndpresbufq" -version = "0.1.3" +version = "0.1.4" edition = "2021" license = "0BSD" # https://crates.io/category_slugs categories = [ "data-structures" ] keywords = [ "buffer", "queue", "bounded", "bounds-preserving" ] Index: src/lib.rs ================================================================== --- src/lib.rs +++ src/lib.rs @@ -218,12 +218,15 @@ if self.size + nlen > max_size { return Err(n); } } - self.size += nlen; - self.q.try_return(n) + let ret = self.q.try_return(n); + if ret.is_ok() { + self.size += nlen; + } + ret } /// Take next buffer off queue. #[inline] pub fn pop(&mut self) -> Option> { Index: www/changelog.md ================================================================== --- www/changelog.md +++ www/changelog.md @@ -1,20 +1,31 @@ # Change Log ## [Unreleased] -[Details](/vdiff?from=bndpresbufq-0.1.3&to=trunk) +[Details](/vdiff?from=bndpresbufq-0.1.4&to=trunk) ### Added ### Changed ### Removed --- -## [0.1.3] +## [0.1.4] - 2024-10-05 + +[Details](/vdiff?from=bndpresbufq-0.1.3&to=bndpresbufq-0.1.4) + +### Changed + +- [bugfix] Didn't update the total queue size when `try_return()` was + successful. + +--- + +## [0.1.3] (yanked) - 2024-10-05 [Details](/vdiff?from=bndpresbufq-0.1.2&to=bndpresbufq-0.1.3) ### Added