#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

#596 in Asynchronous

Download history 941/week @ 2024-12-14 301/week @ 2024-12-21 284/week @ 2024-12-28 875/week @ 2025-01-04 1094/week @ 2025-01-11 747/week @ 2025-01-18 731/week @ 2025-01-25 869/week @ 2025-02-01 1078/week @ 2025-02-08 767/week @ 2025-02-15 854/week @ 2025-02-22 846/week @ 2025-03-01 655/week @ 2025-03-08 1271/week @ 2025-03-15 1123/week @ 2025-03-22 947/week @ 2025-03-29

4,040 downloads per month
Used in 77 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