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

Add methods that take/return arrays #163

Open
joshlf opened this issue Mar 4, 2020 · 2 comments
Open

Add methods that take/return arrays #163

joshlf opened this issue Mar 4, 2020 · 2 comments

Comments

@joshlf
Copy link

joshlf commented Mar 4, 2020

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

@BurntSushi
Copy link
Owner

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.

@Rua
Copy link

Rua commented May 30, 2024

I'd be interested in these as well.

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

3 participants