3
Problems with borrowing Traits
(lemmy.world)
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Credits
That function takes ownership of the Widget, there's no borrowing here. Maybe that's the problem, that you're passing a reference instead of the actual object?
So, if you have a Panel containing the Widget, the function you're calling
render_widgetin has to takeself, not&selfor&mut self.Alternatively, you can use
data: Option<T>in Panel, let the function take&mut selfand then useself.data.take()to move it out of self.I checked the code and noticed that I wrote
&selfas the parameter 🤦🏻Now everything works. Thanks man