Closed SecondFlight closed 2 years ago
That is indeed very odd. I'm not fully understanding why the first version doesn't work since clone
would create an owned version of each reply
.
Have you tried something along the lines of replies.iter().cloned().for_each(...
?
In general it seems like you're just fighting the Rust compiler here in odd ways.
Sorry about that, I pasted the wrong error. I've updated the post above.
Yeah the error seemed odd to me, esp. this part as it doesn't have .clone
and looks like it's passing a reference:
rid::post(reply);
| ^^^^^^^^^ the trait `From<&model::store::Reply>` is not implemented for `DartCObject`
And yes you'll have to clone, there is no way around that. This will be sent to dart and we cannot risk it going out of scope before (no smell there).
Awesome, I'll continue this direction then. Thanks for the response!
I have this helper function:
When compiling, I get the following error:
This solves the issue, but it feels like a code smell:
Is there a better way to do this?