-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
[Feature Request] ByteOrder::read<T> #143
Comments
... immediately after opening this issue I noticed read_uint, which if you make use of TryFrom/TryInto already lets you implement something similar like this: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=0fe4511284d8010049089665d17aa411 (it's not perfect, but it's better than I anticipated beforehand) |
It looks like there's some overlap here between this and #95 and #27.
Are you proposing this signature as something that is actually implementable? Because I don't think it is. You need some kind of additional information about Generally, I think you should just write out the case analysis for stuff like this. Of course, if you can use |
No, I don't think it's directly implementable, I just wanted to propose roughly what it'd look like to the user, i.e. read(src) -> u32 and such. I think this overlaps more with #27 than #95, as the latter seems to be more about run-time dispatch than static dispatch. Regardless, I think your stance after reading the other issue threads is that you think this would complicate the API presented by byteorder, and should be implemented elsewhere. |
Add
to the ByteOrder trait.
In my case, this would be useful so that I can create a wrapper type that specifies the byte order of an integer without having to create an implementation for every integer type. i.e.
Downsides/Arguments against:
This API may have been considered and discarded previously, but I couldn't tell and wanted to double check to make sure.
The text was updated successfully, but these errors were encountered: