Expand description
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
}Structs§
- Must
BoxFuture - 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.
- Must
Future - Wrap a future that may or may not be marked must_use with a newtype that is marked must_use.
Traits§
- Into
Must BoxFuture - Helper trait for converting raw unboxed futures into MustBoxFutures.
Would be nice to
impl<F: Future> Into<MustBoxFuture> for F, but blanket impls in rust core prevent this.