You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case spawn is a generic method, which really means it's an infinite collection of nongeneric methods. You must set the expectation for the right version of spawn, or else the call won't match. Assuming you're going to spawn a BoxFuture, you can do that like this. Unfortunately, some Future types can be very long and hard to name. There's no easy solution to the problem of figuring out a Future's true type.
The problem is I'm using it with async fn, so it's flat out impossible to just name, afaik.
Good thing is I could implement the trait myself, and add a mocked method that's non-generic and simply receives the non-generic BoxFuture. This is far from perfect, but it works.
So, the issue is essence is really not about the Futures, but rather about taking compiler generated types, like Fn, FnMut, FnOnce and Future that can't be addressed any way other than impl ....
I think it's worth creating a dedicated issue for this more generic thing.
With this trait:
How do I mock
spawn
?I tried like this:
The text was updated successfully, but these errors were encountered: