potential 1.0.0

Borrowing for futures - potential enables interior mutation using mutex and asynchronous borrowing (leasing) through a oneshot channel.
Documentation

Borrowing for futures - a bit like Option, but async and with a return channel. A bit like a Mutex, compensating for MutexGuard not being safe to send. The item is moved (leased) from the owner Potential into the Lease. When the Lease is dropped, the item is sent back to the owner. Owner of the Potential can await the return of the leased item.

It is geared towards asynchronous servers. The use case is that some resources can or should be reused, such as TCP connections or crypto configuration or backend storage but they need to be sent off with futures where there is no track of the future of the shared resource unless &mut is used so single copy is guaranteed, Mutex is used with a lifetime bound for the future or you use Potential which allows you not to bind the future lifetime to the source. Still, only one running future/task can use the resource at a time. The owner can thus control the concurrency which is by default 1 and can be increased by resetting the Potential to a new value.

If the lease is not dropped properly (such as if you mem::forget() it or when its thread panics badly), the Potential calls will be stuck forever. If you suspect that this may happen, await with a timeout to be able to recover.