Use IntoFuture for Mutex.lock #5047
Answered
by
Darksonn
LasseRosenow
asked this question in
Ideas
-
Rust 1.64 introduced the IntoFuture Trait. with this we could write: let mutex = Mutex::new(0);
mutex.await; instead of let mutex = Mutex::new(0);
mutex.lock().await; |
Beta Was this translation helpful? Give feedback.
Answered by
Darksonn
Sep 23, 2022
Replies: 1 comment 1 reply
-
Ignoring the fact that this is incompatible with our minimum-supported-rust-version, that doesn't seem like a good idea. It seems less confusing to have an explicit Also, I believe the |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
LasseRosenow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ignoring the fact that this is incompatible with our minimum-supported-rust-version, that doesn't seem like a good idea. It seems less confusing to have an explicit
lock
method.Also, I believe the
.await
ofIntoFuture
consumes the argument, which is not appropriate for locking a mutex.