Macro batch_boxed

Source
macro_rules! batch_boxed {
    [ $($request:expr),* $(,)? ] => { ... };
}
Expand description

Batches API calls in different concrete futures.

The batch function only accepts a collection of the same concrete future e.g. from a single async function or method.

To support different futures (that still return the same type), this macro will place provided futures in a Pin<Box<_>> to erase their type and pass them along to batch.

ยงExamples

let mut windows = window::get_all();
let first = windows.next()?;
let last = windows.last()?;

let classes: Vec<String> = batch_boxed![
    async {
        let class = first.app_id_async().await;
        class
    },
    async {
        let mut class = last.app_id_async().await;
        class += "hello";
        class
    },
];