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

macros: convert to no_std #53

Merged
merged 2 commits into from
May 1, 2023
Merged

Conversation

rmsyn
Copy link
Contributor

@rmsyn rmsyn commented Apr 30, 2023

Converts the macros crate to no_std. Avoids indirectly including std library in a no_std crate.

Converts the `macros` crate to `no_std`. Avoids indirectly including
`std` library in a `no_std` crate.
@haata
Copy link
Collaborator

haata commented Apr 30, 2023

Why is alloc needed? (It can cause issues with certain no_std usage)

@rmsyn
Copy link
Contributor Author

rmsyn commented Apr 30, 2023

Why is alloc needed? (It can cause issues with certain no_std usage)

The library uses containers and traits that require dynamic allocation (notably String and Vec). It's possible to make more changes to feature-gate the parts of the library that require dynamic allocation behind an alloc feature.

It might also be possible to convert the usage to heapless variants that have a static capacity at compile-time. Especially for report descriptors, where the max size is known (64 bytes), heapless variants should be a very easy replacement.

For this PR, I just did the most straight forward thing. If a user has a problem with alloc usage, I can't see how they ever got the std versions to work.

@haata
Copy link
Collaborator

haata commented May 1, 2023

I personally haven't had any issues with the macro crate and no_std. However, I enable the 'host_dep cargo feature: rust-lang/cargo#7915 in my environments.

Please fix up the checks and this should be good.

@haata haata merged commit ca5805b into twitchyliquid64:master May 1, 2023
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