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

Ptah: can we calculate and expose max size of T at compile time #84

Open
IsaacWoods opened this issue Aug 8, 2022 · 0 comments
Open

Comments

@IsaacWoods
Copy link
Owner

For things like ring buffers, it's useful to be able to make a reservation based on the maximum size of a type you're serialising. At the moment, we can calculate this at runtime based on an actual value, but this requires us to walk the type twice (but does have the benefit of always being correct for that value).

I wonder if we can instead calculate the maximum size for a T in the proc macro, and then expose it as a constant item on the type? Secondly, would performance of the proc macro suffer from this (if it is not good to do for every type, can we expose some sort of control on the proc macro to only do this for types we care about?)

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

No branches or pull requests

1 participant