Kimundi / owning-ref-rs

A library for creating references that carry their owner with them.
MIT License
361 stars 50 forks source link

Adding `ToHandle`-like helper functions for Mutex and RwLock #59

Open johnterickson opened 4 years ago

johnterickson commented 4 years ago

Thanks for making this crate! I had some trouble getting RwLock<Vec<RwLock<T>> to work in a hobby project I have and thought I would contribute back the helper functions I came up with.

The reason I would like something like this merged into the crate is so that consumers don't have to write unsafe code to use OwningHandle::new_with_fn with RwLock<T> or Mutex<T>.

I'm not sure where to put these functions, but I'm guessing where they are is not the right place or with the right ergonomics. 😅

johnterickson commented 4 years ago

I've linked the PR. It needs some more work and love 😊 but would like to confirm if this is a direction you'd like to go before I invest more time in it.