byteorder
byteorder copied to clipboard
Add methods that take/return arrays
The recently-added standard library endian conversion functions like from_be_bytes
and to_be_bytes
operate on arrays by value rather than slices by reference, which can provide better type safety in some cases.
It would be great if the ByteOrder
trait were to add similar methods so that code which still needs to be generic over byte order can benefit from the array approach. Concretely, I would make use of those methods in the zerocopy::byteorder
module if they were available.
cc @tamird
I think this is probably okay... I'm a little skeptical of adding these, because it's a lot of methods. And it's not clear to be how broadly applicable they are. I almost never have an array for example and always need to convert a slice into an array to use the standard library routines.