speedy
speedy copied to clipboard
Please fix: lengths encoding, fixed-size arrays and references
-
T::minimum_bytes_needed()
for some types returns hardcoded values, instead of values based onsize_of::<T>()
, which leads to errors on 64-bits machines. For example, encoding aBTreeSet
with more than 2**32 elements won't work properly. -
Now
Readable
andWritable
are only implemented for fixed-size arrays up to 16. Please use generic const expressions and implement them for any size array. -
Readable
andWritable
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.
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.