Alan Somers
Alan Somers
Merge conflict resolved, @workingjubilee .
Hm, you're right. I always intended to give writers priority over readers, but now that I review the code I see that I didn't actually do that. Thanks for pointing...
This is a complicated trait. Does it work if you define that method like this? `fn iter_mut(&mut self) -> impl Iterator
Did you try following that suggestion and adding the bound?
That's actually not as odd as you might think. In order to store the expectation, Mockall requires that the lifetime of return values be either the same as the object...
When mocking a function that returns a reference, Mockall stores that referent within the mock object. For example: ```rust #[automock] pub trait Foo { fn foo(&self) -> &i32; } #[test]...
I think you can already achieve what you want by using `mock!` instead of `#[automock]`. Try this: ```rust trait Foo { fn bar(&self) -> i32; fn foo(&self) -> i32 {...
No, that wouldn't work. It might work for a few simple cases, but it would be too fragile, because: * The method body may assume that `Self` == `MyStruct` instead...
Have you tried adding a lifetime parameter, like this? ``` fn bar
> What if I want to mock a trait from another crate that I cannot simply add the lifetimes to? Then you'll have to manually write a mock function. You...