Skip to content

Conversation

@wcampbell0x2a
Copy link
Collaborator

  • Add new derive DekuSize, which emits SIZE_BYTES and SIZE_BITS. This can be use to get the max bit/byte size of the parsed enum/struct so that your stack/heap can be properly allocated before usage.
  • Generated for all primitive and std types we have, others such as Vec are impossible.

Closees #599, #307

@sharksforarms sharksforarms self-requested a review November 10, 2025 13:10
@sharksforarms
Copy link
Owner

Thanks!

This should be ok given they're all types with known sizes. There may be some optimizations we could do for say count = 5 on a Vec<T>

Can we have a trybuild test in order to confirm what the error is when we DekuSize on something like a Vec?

@wcampbell0x2a
Copy link
Collaborator Author

Can we have a trybuild test in order to confirm what the error is when we DekuSize on something like a Vec?

Added.

* Add new derive DekuSize, which emits SIZE_BYTES and SIZE_BITS.
  This can be use to get the max bit/byte size of the parsed enum/struct
  so that your stack/heap can be properly allocated before usage.
* Generated for all primitive and std types we have, others such as Vec
  are impossible.

Closees #599, #307
sharksforarms
sharksforarms previously approved these changes Nov 11, 2025
Copy link
Owner

@sharksforarms sharksforarms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! rebased, pending ci

@wcampbell0x2a wcampbell0x2a merged commit a5b8662 into master Nov 13, 2025
17 checks passed
@wcampbell0x2a wcampbell0x2a deleted the add-deku-size branch November 13, 2025 00:44
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.

3 participants