I’m toying with coroutines, related ASM and custom placement.
What I basically have at some point is some extern function which receives address of some service struct, manually placed somewhere in RAM. That extern function must invoke that struct as a () -> () function and then drop it properly, BUT without deallocating its memory, moving it somewhere etc.
First I thought about just placing &FnOnce() + Drop fat pointer near struct, and reference it. But it’s not possible because FnOnce should own and move its context. That struct will also definitely contain FnOnce()+Send+'static, which must be also called properly.
The only idea I have is to read &FnOnce at provided address and then unsafely (*ref)().
Any other ideas?