Description
openedon Aug 17, 2023
Although we do not do so currently, it's valid to implement FromZeroes
and FromBytes
for tuples of any size, so long as all of the elements of those tuples also implement those traits. Use this as a model for how to provide generic implementations of these traits:
Lines 1094 to 1108 in 0ff2dd1
Note: We cannot implement Unaligned
nor AsBytes
for any tuple type other than ()
— all other tuple types have the default representation, and so a) there is no upper bound on their alignment and, b) there are no guarantees made about the absence of padding.
Additionally, add tests for the presence/absence of these impls for various concrete tuple types (where the tuple element types are both sufficient and insufficient for generating the impl for the entire tuple). The assert_impls!
macro may be helpful for this:
Line 4512 in b083f1f
Following the lead of the standard library, we should implement these traits for tuples up to size 12.