Crates.io | lease |
lib.rs | lease |
version | 0.5.2 |
source | src |
created_at | 2021-06-08 16:06:44.264254 |
updated_at | 2024-10-28 20:34:49.662638 |
description | Object pool that leases values and automatically returns them with async support |
homepage | |
repository | https://github.com/tylerhawkes/lease |
max_upload_size | |
id | 407852 |
size | 46,838 |
This crate provides a Pool
struct that allows taking Lease
es and using them.
When a Lease
is dropped it is automatically returned to the pool.
One nice thing about this api is that the lifetime of a Lease
is not connected to the lifetime
of a Pool
so they can be sent across threads.
There is also an InitPool
that ensures that all new leases are created the same way
A LockedPool
only allows calling functions that do not add or remove any Lease
s
async
Pool::get()
] function. Async brings a little bit of overhead to getting
leases so it is behind a feature.Pool::stream()
] function that allows getting a stream of leases as they become available