How to do an in-place mapping of values in containers from a T to a newtype wrapper of T?

The rust reference is a better choice here if you want an authoritative source:

  • repr(C) - only looks at field order, size, alignment
  • repr(transparent) - have the same layout (and thus size and alignment) as the inner

The inner-most repr(Rust) can do whatever it wants, it won't affect the choices of the structs it is nested inside. And it cannot suddenly make a different decisions because you can always take references to the inners, so C -> transparent -> rust and C -> rust must be the same within one compilation.

1 Like

I think that is what should be linked from the std docs then. It is quite natural to assume the docs of the function of interest is what you should read.