Skip to content

sm::CpuAligned not implemented for !Sized + sm::CpuLayout structs #14

@RayMarch

Description

@RayMarch

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::CpuAligned to the public interface.
  • add an impl block for sm::CpuAligned in the #[derive(sm::CpuLayout)] macro that takes the same bounds as the impl block for sm::CpuLayout and infers the alignment and optional size from the fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions