#async #future #must-use

must_future

A wrapper future marked must_use - mainly to wrap BoxFutures

3 releases

0.1.2 Jun 11, 2020
0.1.1 Apr 10, 2020
0.1.0 Apr 3, 2020

#1207 in Asynchronous

Download history 1202/week @ 2025-10-18 1266/week @ 2025-10-25 1533/week @ 2025-11-01 1278/week @ 2025-11-08 1738/week @ 2025-11-15 1953/week @ 2025-11-22 1049/week @ 2025-11-29 1139/week @ 2025-12-06 1111/week @ 2025-12-13 1025/week @ 2025-12-20 1084/week @ 2025-12-27 1639/week @ 2026-01-03 1056/week @ 2026-01-10 1443/week @ 2026-01-17 1078/week @ 2026-01-24 1223/week @ 2026-01-31

5,135 downloads per month
Used in 85 crates (10 directly)

Apache-2.0

8KB
121 lines

Crates.io Crates.io

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
}

Dependencies

~0.6–0.8MB
~15K SLoC