State of FnBox?


I was looking to resume work on a hobby project that heavily uses boxed closures. Back then, it seems I switched to nighly and used #![feature(fnbox)].

What's the state of boxed closures now? I see issue #28796 but no workaround in sight. Also, fn_box on doesn't compile on stable.

Am I stuck on nightly or is there a way to used boxed closures on stable?

Thanks in advance!


You can make them work with a bit of indirection:

So, the trick is to

  • Declare a "hidden" trait that you can implement for FnOnce
  • Implement it for Box<Self> generically

Looks good. I'll try it out!

Thanks for your advice!