How to write test async functions without using trait objects

I am not proficient with async myself. But I was wondering if you had seen this async book chapter on using traits for testing. There is also this page in the tokio tutorial that has a section on Mocking using AsyncRead and AsyncWrite.

Have you tried creating two implementations of your trait (testing and production) without using trait objects, i.e., without using dyn? If that didn't work out, what problems did you encounter that led you to using trait objects?

Obviously it is more convenient to pass in a trait object than to use generic params in multiple places. So perhaps a better question is whether these traits could be made object safe.

If you're sure you do need trait objects, and it is not practical for the trait to be object safe, see @steffahn's solution in the earlier thread. (I assumed you had already seen it since you posted there.)