name-it 0.1.5

Give a name to async fn return types
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use futures::{pin_mut, FutureExt as _};
use name_it::name_it;

async fn bar() {}

#[name_it(Test)]
async fn has_lifetime(x: &str) -> String {
    bar().await;
    x.to_string()
}

#[test]
fn should_work() {
    let x = String::from("Hi!");
    let y: Test = has_lifetime(x.as_str());
    pin_mut!(y);
    assert_eq!(y.now_or_never().unwrap(), "Hi!");
}