8 releases (3 stable)

2.0.0 Jul 19, 2023
1.3.0-beta.2 Jul 17, 2023
1.1.0 Mar 19, 2021
1.0.0 Apr 14, 2020
0.2.2 Mar 13, 2018

#202 in Asynchronous

Download history 60104/week @ 2024-11-30 154670/week @ 2024-12-07 112246/week @ 2024-12-14 21807/week @ 2024-12-21 58448/week @ 2024-12-28 123153/week @ 2025-01-04 138122/week @ 2025-01-11 94207/week @ 2025-01-18 117771/week @ 2025-01-25 117749/week @ 2025-02-01 124658/week @ 2025-02-08 123832/week @ 2025-02-15 163327/week @ 2025-02-22 159041/week @ 2025-03-01 157614/week @ 2025-03-08 120023/week @ 2025-03-15

630,797 downloads per month

Apache-2.0

18KB
392 lines

Lazy Pool

Build Status

A lazy-initialized object pool. Provides a sharable pool where objects are initialized on demand. The pool works by providing Futures which allow for usage with async/await (untested) and threading as well.

See tests for examples of usage

Release Notes

2.0.0

  • Reworked most of the package to make it async-first. Having the factory methods being synchronous would force switching from async - to sync - to async which didn't work in many cases. The interface changed significantly.
  • Locking is now using async-aware mutexes.
  • Releasing objects back to the pool needs to be done outside of Drop (until AsyncDrop becomes a thing). Introduced a get macro to be used as the main means of acquiring and using an item.

1.1.0

  • Allow marking an object as tainted through the Pooled wrapper. This drops the item from the pool instead of releasing it.

1.0.0

  • Migrate to std futures.

0.2.3

  • Introduce mutable dereferencing

0.2.1

  • Minor fixes and switch to VecDeque

0.2.0

  • Deprecated all previous version due to misusing Future trait
  • Allow definition of a factory using closures. This adds the overhead of needing a box for function references as well

Dependencies

~0.9–1.6MB
~33K SLoC