See my proposal sketch. I think my solution is much cleaner, since it makes field offsets into real types that can be used anywhere. There's no need to use closures as a proxy for this, since closures that project a field can always be inlined. In fact, your proposal will probably result in binary bloat due to having to monomorphize for every field! (Mind, mine has a similar problem, but it's only a problem per field type.)
Actually, it doesn't. Pin
only requires the Unpin
trait, which is implemented as an auto trait
, an std
-only feature currently- but certainly not Pin
-specific.