Skip to content

Implemented TryFrom<biguint> for primitives#148

Merged
dvdplm merged 6 commits into
paritytech:masterfrom
shaunxw:feature/try-from
May 15, 2019
Merged

Implemented TryFrom<biguint> for primitives#148
dvdplm merged 6 commits into
paritytech:masterfrom
shaunxw:feature/try-from

Conversation

@shaunxw
Copy link
Copy Markdown
Contributor

@shaunxw shaunxw commented May 12, 2019

Closes #131

With TryFrom implementation, users could try conversion from big uint types to primitive uint types. Such as:

  • u128::try_from(U256([0, 1, 0, 0]))
  • U256([0, 0, 1, 0]).try_into().unwrap_or(u128::max_value())

@parity-cla-bot
Copy link
Copy Markdown

It looks like this contributor signed our Contributor License Agreement. 👍

Many thanks,

Parity Technologies CLA Bot

Copy link
Copy Markdown
Contributor

@ordian ordian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Just one small suggestion.

Comment thread uint/src/uint.rs
@ordian ordian requested a review from dvdplm May 13, 2019 09:52
Comment thread uint/src/uint.rs
Comment thread uint/src/uint.rs Outdated
Comment thread uint/src/uint.rs
Comment thread uint/src/uint.rs
Comment thread uint/src/uint.rs
@dvdplm dvdplm merged commit 25da323 into paritytech:master May 15, 2019
@ordian
Copy link
Copy Markdown
Contributor

ordian commented May 15, 2019

published 0.7.1

dvdplm added a commit that referenced this pull request May 16, 2019
* master:
  [parity-crypto] Derive Debug for digests and signatures (#155)
  Restore the previous API to allow variable size keys for Hmac operations (#152)
  Implemented TryFrom<biguint> for primitives (#148)
ordian added a commit to ordian/parity-common that referenced this pull request May 16, 2019
* paritytech/master:
  [parity-bytes] add no-std support   (paritytech#154)
  [parity-crypto] Derive Debug for digests and signatures (paritytech#155)
  Restore the previous API to allow variable size keys for Hmac operations (paritytech#152)
  Implemented TryFrom<biguint> for primitives (paritytech#148)
dvdplm added a commit that referenced this pull request May 19, 2019
* master:
  [parity-crypto] zero memory for hmac signing keys (#157)
  Added absolute path for 'Result' usage in macros to avoid type collisions. (#160)
  [parity-bytes] add no-std support   (#154)
  [parity-crypto] Derive Debug for digests and signatures (#155)
  Restore the previous API to allow variable size keys for Hmac operations (#152)
  Implemented TryFrom<biguint> for primitives (#148)
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

Successfully merging this pull request may close these issues.

Support TryFrom/TryInto for uint types

4 participants