rylv-pool
Generic pooling with pluggable providers, extracted from rylv_utils.
PoolItemdefines how reusable values are reset.PoolProvidercontrols acquisition, returns, and prewarming.PoolProvider::Entrylets each provider choose its own ownership handle and routing context, with mutable access andStableDerefguarantees.PoolGuardreturns values automatically on drop and implementsStableDeref.FixedThreadLocalPool<T, N>provides fixed-capacity thread-local storage and lock-free returns from other threads.Nlimits retained entries, not active guards. Its static TLS key reference implementsPoolProviderdirectly.PoolErrorpreserves factory errors and captured unwind panic payloads.
Public types are imported from the crate root. FixedThreadLocalEntry is an
opaque associated type of the thread-local provider; its routing details remain
private. Storage internals and test inspection helpers are not part of the API.
The crate depends only on stable_deref_trait.
use ;
;
thread_local!
let mut scratch = acquire?;
scratch.0.extend_from_slice;
# Ok::
Testing and CI
CI includes stable and MSRV builds on Linux/macOS/Windows, debug/release tests, Clippy, formatting, documentation, coverage artifacts, Miri, fuzzing, dependency security and license checks, semver checks, and tag-driven releases.
The coverage gate requires at least 95% of production lines. See CI setup for commands, artifacts, and required GitHub configuration, and test coverage map for the scenarios.
make verify runs the normal local checks. make coverage, make miri, and
make fuzz opt into the additional tools. cargo test --locked runs the root
crate's unit, integration, and documentation tests.
Benchmarks
make bench runs Criterion benchmarks in the optimized bench profile. Criterion
is a development dependency. They cover local reuse, misses, prewarming, remote
returns, and draining, with small values and reusable buffers. For example:
See benchmark methodology for the scenarios, timing units, and comparison limits. Normal tests run the scenarios as smoke checks without reporting timings. Pull-request CI compares baselines with critcmp and fails on mean slowdowns greater than 15%; the threshold is configurable.
License
Licensed under either Apache License 2.0 or MIT license, at your option.