Add generic GetInto type converter for Get trait#909
Add generic GetInto type converter for Get trait#909bkchr merged 7 commits intoparitytech:masterfrom
GetInto type converter for Get trait#909Conversation
kianenigma
left a comment
There was a problem hiding this comment.
First thought of this alternative, but seeing how you use it in the downstream PR, I see that a struct is more useful https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=de287e5559e1e1d8bb79c9532ee2bfba
|
@Doordashcon please format the code :) |
GetInto type converter for Get traitGetInto trait converter for Get trait
|
please review @kianenigma @bkchr |
bkchr
left a comment
There was a problem hiding this comment.
Yeah not sure why you changed this?
GetInto trait converter for Get traitGetInto type converter for Get trait
|
@Doordashcon Is this already accessible in polkadot-sdk? Maybe we could use it here: https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/message-queue/src/lib.rs#L1720-L1727 instead of? |
|
@bkontur the linked struct is the reason this pr was created. We did not yet release the changes to crates.io. If you need them, go ahead and release a new version :) |
|
Ahh no we added it for this pr, but yeah the idea is that we will use it in Polkadot sdk :) |
Description
Introduces GetInto<Inner, I, R>, a generic converter for the Get trait that leverages Into for type-safe conversions.
Issue
Currently, type conversions using the Get trait require manual implementation for each specific type pair (e.g.,
ConvertU16ToU32).