Idea: syntax for function item types

struct Contrived {
    future: (fn do_thing)::Output,
}

async fn do_thing() {
    // ...
}

impl Contrived {
    async fn await_future(self) {
        self.future.await;
    }
}

async fn main() {
    let contrived = Contrived {
        future: do_thing(),
    };

    contrived.await_future().await;
}

EDIT: Somehow I didn't notice RFC 2071 until now. Looks like a better solution to the same problem, and it's already implemented.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.