collet 0.1.1

Relentless agentic coding orchestrator with zero-drop agent loops
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::future::Future;
use std::time::Duration;
use tokio::time::timeout;

/// Execute a future with a timeout, returning a descriptive error on timeout.
pub async fn with_timeout<T, F>(duration: Duration, label: &str, future: F) -> anyhow::Result<T>
where
    F: Future<Output = anyhow::Result<T>>,
{
    match timeout(duration, future).await {
        Ok(result) => result,
        Err(_) => {
            anyhow::bail!("{label} timed out after {}s", duration.as_secs())
        }
    }
}