Closed TheDan64 closed 1 year ago
Interesting, I guess I forgot to think about this pattern. I believe this shouldn't be too hard to fix, as generic traits are already possible to mock. The MockFn
is per-method anyway and it can reuse some of the existing proc-macro code for generics. I'll take a look.
Hey @audunhalland - I work with @TheDan64 and we are using entrait and unimock for our new API server stack! Just wanted to say thank you for your great work on these libraries. Dependency Injection and mocking in Rust have always been an uphill battle... less so now!
0.4.9
has been released with support for this.
Thank you so much!!
Saw #7, but doesn't seem related. For example:
(in a more realistc example, T would be constrained to some trait, like
serde::Deserialize
)I would say that this is a pretty big limitation to using entrait/unimock, since you can't mock db queries which specify which data model to deser a query result to