autoreturn-pool
This pool automatically manages the return of objects.
The primary difference from competitors is the interface - implementation follows the RAII pattern, meaning the user must provide objects when creating the pool.
The Pool class has only three public methods:
- Constructor
with_config(config: Config, items): Creates a new pool with a custom configuration. - Constructor
new(items): An alias forwith_configthat uses the default configuration. take(&self): Extracts an object from the pool.
The configuration allows you to set the wait duration for the take method (default is Duration::MAX, which essentially means "Wait until you receive it").
Examples:
// with custom object: