

I’m not sure how you intend to use this. When no variables are captured, the borrow checker will not have any issues with the closure method.
When you are still capturing, you could implement a macro like one answer suggests. However, IMO this highly depends on the complexity of the duplicated code and even then I don’t immediately see what the benefits compared to extracting it as a closure/function are.
Nice giveaway, thank you for the generosity.
Is Gamedec still available? If so, I’d like to take it :)