|
|
Subscribe / Log in / New account

Transmute to user-defined types with all public fields?

Transmute to user-defined types with all public fields?

Posted Oct 26, 2024 15:27 UTC (Sat) by asahilina (subscriber, #166071)
In reply to: Transmute to user-defined types with all public fields? by roc
Parent article: Toward safe transmutation in Rust

That is the simplified version and what is already being done with macros in certain crates: you can transmute into types where all bit patterns are valid. But what is being researched here seems to be more general, e.g. you would in theory be able to transmute [NonZeroU8; 4] into NonZeroU32, though not vice versa, despite neither type having all bit patterns valid.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds