Feature request: poll_lock(cx) for Mutex
I want to lock a Mutex<T> in my poll_read method but it seems like that there is no way to lock and wait for a Mutex in a non-async function. My workaround is creating an async closure and getting it boxed and pinned, storing it somewhere else, and then polling it, which is really annoying and inefficient.
https://github.com/black-binary/ap-kcp/blob/6bf035ea0349165094bf44e13ff4b09cb2bf66ab/src/async_kcp.rs#L54-L67
I think it would be nice if there are some methods like poll_lock(cx).
I'd accept a PR for this method :)
I think a better way of doing this would be like in smol-rs/async-channel#33, where we have a manual Future implementation for the locking functions. This is basically what the PR (#5) does anyways, and we could probably make it more generic.