Don't use boxes: Not only this avoids allocation but also makes no_std implementation possible.
I didn't bother to rewrite the comment (it's not like I entirely understand how it works anyway). but there are 2 main issues to consider:
1) Alignment: union Blank has both the max size and max alignment of its arguments
2) Niches: for some implementation-defined reason this combination of Options and Result works. We likely use the fact that union have no niches.
Together with removing black_box and inline(never) this achieves performance identical with std on my ARMv8.
Don't use boxes: Not only this avoids allocation but also makes no_std implementation possible. I didn't bother to rewrite the comment (it's not like I entirely understand how it works anyway). but there are 2 main issues to consider: 1) Alignment: union Blank has both the max size and max alignment of its arguments 2) Niches: for some implementation-defined reason this combination of Options and Result works. We likely use the fact that union have no niches.
Together with removing black_box and inline(never) this achieves performance identical with std on my ARMv8.