Yes, except the function itself returns a Boxed & Pinned future...
fn handle_url(url: String) -> Pin<Box<dyn Future<Output=Result<(), ()>> + Send>> {
Box::pin(async move {
if url.len() <= 1 {
return Ok(());
}
let child_url = (&url[1..]).to_string();
tokio::spawn(handle_url(child_url));
Ok(())
})
}
Playground: Rust Playground