I'm trying to implement a "builder" for a struct, and am running into a wall because the struct in question uses a Box<dyn trait> type for a field. I've created a (non-functional) playground to illustrate. I'll share an excerpt here:
Of course, I cannot move out of self.buzzer which is behind a shared reference. Are there any recommendations for a way that I could achieve this without modifying the underlying Gizmo struct?
Very delayed response, but just wanted to say thank you everyone here! The solution that I used was to consume self in the build function as @derspiny and @jumpnbrownweasel suggested. I marked @derspiny's response as the solution only because he included a code snippet. Thanks again!