pub async fn with_timeout<F, T>(duration: Duration, future: F) -> Result<T>Expand description
Execute an async operation with a timeout
Returns Error::Timeout if the operation doesn’t complete within the specified duration.
§Examples
use llm_memory_graph::error::timeout::with_timeout;
use std::time::Duration;
let result = with_timeout(
Duration::from_secs(5),
async {
// Your async operation here
Ok::<_, llm_memory_graph::error::Error>(42)
}
).await?;