Closed pgherveou closed 6 days ago
Thanks. The
From
implementation already bit me when converting from little endian.I am not sure of we should also bump the version in this PR or if this is done at release time.
Looks like bumping is done in releases, I can update the changelogs once this is approved by owners
FWIW the alloy_primitives
U256
doesn't support this conversion neither (although I don't know the exact reason).
Implementing From
where the conversion isn't obvious is against the API guidelines. See the last point here. They even mention bytes to number conversion as an explicit example where to not implement it.
Looks like bumping is done in releases, I can update the changelogs once this is approved by owners
Updating the changelogs should ideally happen in the PR itself. If you want to release a new version straight away, you can also bump the versions here. Note that this breaking change will propagate to other crates like primitive-types
.
It's also a good practice to write how to migrate to a new version in the changelog (this method removed, use that instead).
Releasing a new version then should be easy: https://github.com/paritytech/parity-common/blob/master/CONTRIBUTING.md#releasing-a-new-version
FWIW the alloy_primitives
U256
doesn't support this conversion neither (although I don't know the exact reason).Implementing
From
where the conversion isn't obvious is against the API guidelines. See the last point here. They even mention bytes to number conversion as an explicit example where to not implement it.
Agreed. This code in uint is very old and predates these guidelines probably.
Changes:
to_big_endian
andto_little_endian
are renamedwrite_as_*
to_little_endian
andto_big_endian
are now functions that returns the bytes array