Function boxed_future

Source
pub fn boxed_future<T, F, Fut, E>(
    f: F,
) -> impl FnOnce(T) -> Pin<Box<dyn Future<Output = Result<(), E>> + Send>>
where F: FnOnce(T) -> Fut + Send + 'static, Fut: Future<Output = Result<(), E>> + Send + 'static, T: Send + 'static, E: Send + 'static,
Expand description

Boxes an async closure to handle lifetime issues

This function takes a closure that returns a Future and wraps it in a Pin<Box> to solve lifetime problems. This is particularly useful for async closures that capture variables from their environment.