Using a struct with Predicate #646
-
|
Hi, |
Beta Was this translation helpful? Give feedback.
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? |
Beta Was this translation helpful? Give feedback.
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.