cli_engineer 2.0.0

An autonomous CLI coding agent
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use anyhow::Result;
use tokio::task::JoinHandle;

/// Runs tasks concurrently using tokio.
#[allow(dead_code)]
pub async fn run_parallel<T, F>(futs: Vec<F>) -> Result<Vec<T>>
where
    F: std::future::Future<Output = Result<T>> + Send + 'static,
    T: Send + 'static,
{
    let handles: Vec<JoinHandle<Result<T>>> = futs.into_iter().map(|f| tokio::spawn(f)).collect();

    let mut out = Vec::new();
    for handle in handles {
        out.push(handle.await??);
    }
    Ok(out)
}