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

Byte-rearranging methods on u8 and i8 should be deprecated #44724

Closed
clarfonthey opened this issue Sep 20, 2017 · 4 comments
Closed

Byte-rearranging methods on u8 and i8 should be deprecated #44724

clarfonthey opened this issue Sep 20, 2017 · 4 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@clarfonthey
Copy link
Contributor

clarfonthey commented Sep 20, 2017

Considering how there's no common trait for these, it makes sense that u8::swap_bytes, u8::from_le, u8::from_be, u8::to_be, and u8::from_be should all be deprecated. These methods have no effect and it is slightly confusing to have them.

@steveklabnik
Copy link
Member

I am slightly confused about this issue, but it might just be me!

  • Why does "there's no common trait for these" matter?
  • They "have no effect"? At least the docs show examples where they do things.

@kennytm
Copy link
Member

kennytm commented Sep 20, 2017

@steveklabnik All of these are identity functions ("no effect") since u8 and i8 are one-byte long.

@est31
Copy link
Member

est31 commented Sep 20, 2017

I think consistency with other integer types can be an argument for keeping the functions even though they are no-ops. Responding to the "there is no trait" argument, you can implement generic stuff via macros as well and expect the functions to exist. Being generic over integer types is notoriously hard as there is no "summary trait" for integers, at least not in the standard library.

@TimNN TimNN added C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Sep 20, 2017
@clarfonthey clarfonthey changed the title Byte-rearranging methods on u8 should be deprecated Byte-rearranging methods on u8 and i8 should be deprecated Sep 20, 2017
@dtolnay
Copy link
Member

dtolnay commented Nov 14, 2017

As mentioned, these methods can be useful in macro-generated code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants