Crates.io | swimmer |
lib.rs | swimmer |
version | 0.3.0 |
source | src |
created_at | 2019-08-17 23:09:43.212534 |
updated_at | 2021-02-16 02:31:50.678695 |
description | Thread-safe object pool type |
homepage | |
repository | https://github.com/caelunshun/swimmer-rs |
max_upload_size | |
id | 157712 |
size | 37,876 |
Thread-safe object pools for Rust.
use swimmer::Pool;
let pool: Pool<String> = Pool::with_size(10);
assert_eq!(pool.size(), 10);
let value = pool.get()
assert_eq!(pool.size(), 9);
assert_eq!(*value, "");
drop(value);
// Value is returned to pool
assert_eq!(pool.size(), 10);
See the documentation for more.