Ok, when it was phrased as "types" in the original post I thought it was still types in the rust sense.
Agreed that if it's just about the alignment of fields it's fine.
Ok, when it was phrased as "types" in the original post I thought it was still types in the rust sense.
Agreed that if it's just about the alignment of fields it's fine.
as i see it, the main utility of this sort of namespacing is preventing namespace pollution... which seems like it has dubious utility, i'm not sure what else #[align]
could mean in this position exempt exactly this. i guess it's possible there's a proc macro out there that uses this already.
Well, it sort of is, because the ideal solution would be to have the ability to define a WgslVec3
type that will just do the right thing when used in a #[repr(C)]
structure. But, as you pointed out, that would require breaking a fundamental Rust design choice.
Explicit field alignments like this are the next-best thing, but are still fundamentally a work-around for the impedance mismatch between the two languages.
another usecase for this would be to guarantee a struct's layout is the same for all architectures. could be useful if it doesn't have any non-u8 fields.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.