-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Mutex::into_inner() #1269
Comments
Seems like a pretty straightforward thing to add - I'm kind of surprised it's not there already. |
We may want pub fn get_mut(&mut self) -> LockResult<&mut T>; because if you have mutable access to a mutex there's no need for synchronization! |
The implementation for `into_inner` was a bit more complex than I had hoped for---is there any simpler, less unsafe way of getting around the fact that one can't move out of a `Drop` struct? See #28968 and rust-lang/rfcs#1269 .
This is fixed by rust-lang/rust#29031 with rust-lang/rust#28968 as tracking issue for stabilization. |
Thanks @cristicbz! |
This is very useful for structures like this:
The text was updated successfully, but these errors were encountered: