10 unstable releases (3 breaking)
0.4.0 | Aug 29, 2022 |
---|---|
0.3.3 | Mar 18, 2022 |
0.2.3 | Jul 8, 2021 |
0.2.1 | Jun 9, 2021 |
0.1.0 | Jun 8, 2021 |
#731 in Asynchronous
765 downloads per month
37KB
773 lines
Lease
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.
Features
async
- Enables the
Pool::get_async()
function. Async brings a little bit of overhead to getting leases so it can be disabled. On by default.
- Enables the
lib.rs
:
Lease
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.
Features
async
- Enables the [
Pool::get_async()
] function. Async brings a little bit of overhead to getting leases so it is behind a feature.
- Enables the [
stream
- Enables the
async
feature and adds the [Pool::stream()
] function for creating a stream of leases that resolve anytime there is an availableLease
- Enables the
Dependencies
~0.7–6MB
~16K SLoC