shame
shame copied to clipboard
`sm::CpuAligned` not implemented for `!Sized + sm::CpuLayout` structs
trafficstars
the trait sm::CpuAligned is not public and not implemented for !Sized + sm::CpuLayout structs.
as of now, the following code doesn't compile
#[derive(sm::CpuLayout)]
#[repr(C)]
struct Unsized {
a: f32,
b: [f32],
}
< Unsized as sm::CpuAligned>::CPU_ALIGNMENT;
Solution:
- add
sm::CpuAlignedto the public interface. - add an impl block for
sm::CpuAlignedin the#[derive(sm::CpuLayout)]macro that takes the same bounds as the impl block forsm::CpuLayoutand infers the alignment and optional size from the fields.