Using a struct with Predicate #646
Answered
by
asomers
StephanVogt
asked this question in
Questions
|
Hi, |
Answered by
asomers
Apr 2, 2025
Replies: 1 comment 5 replies
|
You said you had a "either a borrow checker issue, or a lifetime issue", but you didn't provide the actual error. Would you? |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This isn't a Mockall problem. It's just a usual Rust lifetime issue. You need
withfto own its argument. You can do that by usingclone. Or you can construct a new object within the closure itself. Or you can makeMyDataa global constant. Or you can examine the data field by field withinwithf. Or you can make use ofArc<Mutex<_>>. There are lots of solutions.