A pinned object pool that can store objects of any type.
The pool returns super-powered pointers (Pooled<T>) that can be copied and cloned freely, providing type-safe access to the stored values. A key feature is the ability to cast these pointers to trait objects while preserving reference counting semantics.
Quick start
use BlindPool;
// Create a pool with automatic cleanup and thread safety.
let pool = new;
// Insert different types, get handles with automatic dereferencing.
let u32_handle = pool.insert;
let string_handle = pool.insert;
// Access values through automatic dereferencing.
assert_eq!;
assert_eq!;
// Clone handles freely - values stay alive as long as any handle exists.
let cloned = u32_handle.clone;
assert_eq!;
// Automatic cleanup when all handles are dropped - no manual cleanup needed!
Trait object support
use ;
use Display;
// Enable casting to Display trait objects
define_pooled_dyn_cast!;
let pool = new;
// Insert different types that implement Display
let int_handle = pool.insert;
let string_handle = pool.insert;
// Cast to trait objects while preserving reference counting
let int_display = int_handle.cast_display;
let string_display = string_handle.cast_display;
// Use them uniformly through the trait
print_value;
print_value;
More details in the package documentation.
This is part of the Folo project that provides mechanisms for high-performance hardware-aware programming in Rust.