Skip to content

Generate associated constants indicating serialized size for *Report types #74

@CobaltCause

Description

@CobaltCause

To implement this, a new trait like this could be added:

pub trait ReportSize {
    const BYTES_COUNT: usize;
}

and then an implementation of this trait is generated for report types automatically by #[gen_hid_descriptor]. I'm not sure if there needs to be two associated constants, one for input and output, or if they're always the same size and so one associated constant would suffice.

This would be useful for automatically statically allocating buffers via the type system instead of having to hard-code magic numbers.

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