You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The recently-added standard library endian conversion functions like
from_be_bytes
andto_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 thezerocopy::byteorder
module if they were available.cc @tamird
The text was updated successfully, but these errors were encountered: