Closed
Description
impl<T> Mutex<T> {
pub fn into_inner(self) -> T {
...
}
}
This is very useful for structures like this:
struct Foo {
data: Mutex<Bar>
}
impl Foo {
fn modify(&self) {
self.data.lock().unwrap().modify();
}
fn consume(self) {
let bar = self.data.into_inner(); // oops! doesn't exist
bar.consume();
}
}
Metadata
Metadata
Assignees
Labels
No labels