-
I'm learning rust. I'm attempting to mock write_frame with mockall. I've set up my mock with the following:
I'm getting the following error: Which appears to be coming from:
I've attempted to add static in a few places but that seems to break the trait by implementing stricter requirements. For example changing the following:
Results in
I get similar errors when adding static to the generic type in the signature. Could some one help me out here? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
I did search the forum. I think there are similar cases but I'm not sure since I'm still learning rust. |
Beta Was this translation helpful? Give feedback.
-
This is a perennial problem. Due to limitations in the language, Mockall has very limited ability to mock functions with non-
|
Beta Was this translation helpful? Give feedback.
You'll have to do the mocking at least partially manually. For instance, you could use mockall for inherent methods, and inner methods, and then manually impl the trait. If you're sure the lifetimes are safe, you can even transmute them , like this: