Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a
::Bytes
associated type along withInto
andFrom
instances.In fact, I'm no longer completely sure if the
struct Endiannes<T>(T);
approach taken by this crate always makes the most sense :From
instance, although maybe this does not matter.<LittleEndian<T> as Endian<T>>::Bytes
, so you want a macro, but if you use a macro then you can do almost anything.We might try this alternative formulation instead
so users can access the bytes with
.0
and all the conversions happen withinto
andfrom
calls the converted to the integer representation. There is seemingly no way to shorten the trail of traits one needs to define this however. And one must take care if trying to make this polymorphic on endianness due to rust's lack of higher kinded types.