Closed rotmanben closed 2 months ago
You probably want your mock type to be generic, right? If so, do pub DbClient<T>
. If not, then you probably want to impl a specific instantiation of the trait, like SaveTx<u32>
.
You probably want your mock type to be generic, right? If so, do
pub DbClient<T>
. If not, then you probably want to impl a specific instantiation of the trait, likeSaveTx<u32>
.
Thank you for the suggestion! Implementing a specific instantiation of the trait solved my issue
Glad to help.
I'm trying to mock a generic trait using mock! but but I'm getting this compiler error: "the type parameter T is not constrained by the impl trait, self type, or predicates"
Here's the relevant code:
Is there a workaround or a correct way to do that? I'm relatively new to this library, so any guidance would be appreciated.
Thanks a lot :)