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

Please fix: lengths encoding, fixed-size arrays and references #28

Open
seniorjoinu opened this issue Oct 16, 2022 · 1 comment
Open

Comments

@seniorjoinu
Copy link

  1. T::minimum_bytes_needed() for some types returns hardcoded values, instead of values based on size_of::<T>(), which leads to errors on 64-bits machines. For example, encoding a BTreeSet with more than 2**32 elements won't work properly.

  2. Now Readable and Writable are only implemented for fixed-size arrays up to 16. Please use generic const expressions and implement them for any size array.

  3. Readable and Writable are not implemented for &[u8] and similar types which is a shame.

Please, consider fixing these issues. If you need a PR, I can provide you with one.

@koute
Copy link
Owner

koute commented Oct 28, 2022

The first point is a feature, not a bug. If you need to store more than 2^32 elements you can always use the length_type attribute or create a newtype. Besides, we can't really change this without breaking backwards compatibility even if we wanted to as the serialization format is stable and will not change.

Points (2) and (3) are indeed reasonable and could indeed be fixed.

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

2 participants