You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we use plain as a way to do safe cast from byte slices to POD types (which we do in a few places). There is a problem with plain however: We need to manually unsafe impl Plain for Type {}, and when doing so, we need to manually check that the invariants are upheld (especially regarding the absence of padding bytes).
Enter typelayout. It's a bit of a crazy crate that will implement a few traits on types if their layout follow certain rules (such as NoPadding being present only if the crate has no padding bits). It does so by leveraging frunk, another crazy crate that, with the help of a derive macro, allows getting information on a type's layout.
I would like to try removing all usage of plain and replacing it with typelayout, as it would allow us to automatically ensure all the invariants are being upheld. However, we need to make sure we don't take a huge compile-time hit, as frunk could possibly be a bit heavy. Needs some checking.
The text was updated successfully, but these errors were encountered:
Currently, we use
plain
as a way to do safe cast from byte slices to POD types (which we do in a few places). There is a problem withplain
however: We need to manuallyunsafe impl Plain for Type {}
, and when doing so, we need to manually check that the invariants are upheld (especially regarding the absence of padding bytes).Enter typelayout. It's a bit of a crazy crate that will implement a few traits on types if their layout follow certain rules (such as NoPadding being present only if the crate has no padding bits). It does so by leveraging frunk, another crazy crate that, with the help of a derive macro, allows getting information on a type's layout.
I would like to try removing all usage of plain and replacing it with typelayout, as it would allow us to automatically ensure all the invariants are being upheld. However, we need to make sure we don't take a huge compile-time hit, as frunk could possibly be a bit heavy. Needs some checking.
The text was updated successfully, but these errors were encountered: