pub fn boxed_future<'a, T>(
fut: impl Future<Output = T> + Send + 'a,
) -> Pin<Box<dyn Future<Output = T> + Send + 'a>>Expand description
Wraps an async expression into Pin<Box<dyn Future<Output = T> + Send + 'a>>.
This is the minimal helper for reducing AgentExecutor
boilerplate. Instead of:
ⓘ
fn execute<'a>(...) -> Pin<Box<dyn Future<Output = A2aResult<()>> + Send + 'a>> {
Box::pin(async move { ... })
}You can write:
ⓘ
fn execute<'a>(...) -> Pin<Box<dyn Future<Output = A2aResult<()>> + Send + 'a>> {
boxed_future(async move { ... })
}