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

Cannot Use Heapless Vec with Capacity > 32 Due to Default Impls #215

Closed
pperanich opened this issue Jan 3, 2025 · 2 comments · Fixed by #216
Closed

Cannot Use Heapless Vec with Capacity > 32 Due to Default Impls #215

pperanich opened this issue Jan 3, 2025 · 2 comments · Fixed by #216

Comments

@pperanich
Copy link
Contributor

With the current implementation of variable-length fields (when using heapless Vecs), you are limited to a Vec of length 32 or less. This is because the underlying storage is a [u8; N], and Default::default() is used to initialize the static cell. However, the Default trait in the standard library is only implemented for [u8; 32] and smaller. Attempting to use a larger heapless Vec leads to a compile error (rust-lang/rust#61415).

@jamessizeland
Copy link
Collaborator

Thanks for spotting this! Do you intend to PR a fix or would you like us to look at it?

@pperanich
Copy link
Contributor Author

Just opened the PR. Very simple fix.

@lulf lulf closed this as completed in #216 Jan 3, 2025
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 a pull request may close this issue.

2 participants