trait Wrap { fn wrap(self, f: F) -> U where F: Fn(T) -> U, Self: Sized; } impl Wrap for T { fn wrap(self, f: F) -> U where F: Fn(T) -> U, { f(self) } } // chain as much as you like! // no more of this: Ok(foo.iter().filter(..).collect()) // pure bliss: foo.iter().filter(..).collect().wrap(Ok) // more realistic example: let responses = futures::future::join_all( batches .iter() .map(|batch| self.choose_files_in_batch(&depgraph, batch.as_slice())), ) .await; // ew! thats awful // lets fix that: let responses = batches .iter() .map(|batch| self.do_async_thing(batch)) .wrap(futures::future::join_all) .await; // much better!