Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default functions to MouseReport, MediaKeyboardReport and SystemC… #66

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

borisfaure
Copy link
Contributor

…ontrolReport

It was already there for KeyboardReport where documentation is added to the function

@twitchyliquid64
Copy link
Owner

I'm guessing this isnt a Default implementation so it can be a const fn?

There was already a default implementation for KeyboardReport but it can
be derived as well.

Also derive Eq & PartialEq to be able to know if 2 reports are different.
@borisfaure
Copy link
Contributor Author

Actually it can be Derived and would produce the same. Thus I've removed the custom default for KeyboardReport. It took the opportunity to merge in PR#65.

@borisfaure
Copy link
Contributor Author

Hi, Any update on this PR?
Thanks

@twitchyliquid64 twitchyliquid64 merged commit 76325c3 into twitchyliquid64:master Jul 16, 2024
@twitchyliquid64
Copy link
Owner

Whelp we should have tested it 😅

error[E0277]: the trait bound `[u8; 64]: core::default::Default` is not satisfied
   --> src/descriptor.rs:985:5
    |
973 | / #[gen_hid_descriptor(
974 | |     (collection = APPLICATION, usage_page = FIDO_ALLIANCE, usage = U2F_AUTHENTICATOR_DEVICE) = {
975 | |         (usage = INPUT_REPORT_DATA, logical_min = 0x0) = {
976 | |             #[item_settings data,variable,absolute] data_in=input;
...   |
981 | |     }
982 | | )]
    | |__- in this procedural macro expansion
...
985 |       pub data_in: [u8; 64],
    |       ^^^^^^^^^^^^^^^^^^^^^ the trait `core::default::Default` is not implemented for `[u8; 64]`
    |
    = help: the following other types implement trait `core::default::Default`:
              [T; 0]
              [T; 1]
              [T; 2]
              [T; 3]
              [T; 4]
              [T; 5]
              [T; 6]
              [T; 7]
            and 27 others
    = note: this error originates in the derive macro `Default` which comes from the expansion of the attribute macro `gen_hid_descriptor` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `[u8; 64]: core::default::Default` is not satisfied
   --> src/descriptor.rs:986:5
    |
973 | / #[gen_hid_descriptor(
974 | |     (collection = APPLICATION, usage_page = FIDO_ALLIANCE, usage = U2F_AUTHENTICATOR_DEVICE) = {
975 | |         (usage = INPUT_REPORT_DATA, logical_min = 0x0) = {
976 | |             #[item_settings data,variable,absolute] data_in=input;
...   |
981 | |     }
982 | | )]
    | |__- in this procedural macro expansion
...
986 |       pub data_out: [u8; 64],
    |       ^^^^^^^^^^^^^^^^^^^^^^ the trait `core::default::Default` is not implemented for `[u8; 64]`
    |
    = help: the following other types implement trait `core::default::Default`:
              [T; 0]
              [T; 1]
              [T; 2]
              [T; 3]
              [T; 4]
              [T; 5]
              [T; 6]
              [T; 7]
            and 27 others
    = note: this error originates in the derive macro `Default` which comes from the expansion of the attribute macro `gen_hid_descriptor` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `usbd-hid` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `usbd-hid` (lib test) due to 2 previous errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants