3 releases
0.1.2 | Jun 11, 2020 |
---|---|
0.1.1 | Apr 10, 2020 |
0.1.0 | Apr 3, 2020 |
#779 in Asynchronous
4,123 downloads per month
Used in 73 crates
(8 directly)
8KB
121 lines
must_future
BoxFutures cannot be marked #[must_use]
because they are just type
definitions. This newtype struct wraps a BoxFuture with something that
can be marked #[must_use]
.
Will Not Compile:
#![deny(unused_must_use)]
use futures::future::FutureExt;
#[tokio::main]
async fn main() {
fn get_future() -> must_future::MustBoxFuture<'static, ()> {
async { }.boxed().into()
}
get_future(); // unused `must_future::MustBoxFuture` that must be used
}
lib.rs
:
BoxFutures cannot be marked #[must_use]
because they are just type
definitions. This newtype struct wraps a BoxFuture with something that
can be marked #[must_use]
.
Will Not Compile:
#![deny(unused_must_use)]
use futures::future::FutureExt;
#[tokio::main]
async fn main() {
fn get_future() -> must_future::MustBoxFuture<'static, ()> {
async { }.boxed().into()
}
get_future(); // unused `must_future::MustBoxFuture` that must be used
}
Dependencies
~1MB
~15K SLoC