-
Notifications
You must be signed in to change notification settings - Fork 699
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
XCM builder pattern improvement - Accept impl Into<T>
instead of just T
#3708
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add the builder pattern here as well? https://paritytech.github.io/xcm-docs/
bot fmt |
just curious, @franciscoaguirre did you check whether or not this change impact the binary size ? |
Definitely! I'm planning on moving those docs to rust docs to get them closer to the actual code and then I'll use the builder pattern there |
No. Is it because of the |
Yeah probably not a concern but monomorphization might generate some extra code |
…st `T` (#3708) The XCM builder pattern lets you build xcms like so: ```rust let xcm = Xcm::builder() .withdraw_asset((Parent, 100u128).into()) .buy_execution((Parent, 1u128).into()) .deposit_asset(All.into(), AccountId32 { id: [0u8; 32], network: None }.into()) .build(); ``` All the `.into()` become quite annoying to have to write. I accepted `impl Into<T>` instead of `T` in the generated methods from the macro. Now the previous example can be simplified as follows: ```rust let xcm = Xcm::builder() .withdraw_asset((Parent, 100u128)) .buy_execution((Parent, 1u128)) .deposit_asset(All, [0u8; 32]) .build(); ``` --------- Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: command-bot <> Co-authored-by: Adrian Catangiu <adrian@parity.io>
…st `T` (paritytech#3708) The XCM builder pattern lets you build xcms like so: ```rust let xcm = Xcm::builder() .withdraw_asset((Parent, 100u128).into()) .buy_execution((Parent, 1u128).into()) .deposit_asset(All.into(), AccountId32 { id: [0u8; 32], network: None }.into()) .build(); ``` All the `.into()` become quite annoying to have to write. I accepted `impl Into<T>` instead of `T` in the generated methods from the macro. Now the previous example can be simplified as follows: ```rust let xcm = Xcm::builder() .withdraw_asset((Parent, 100u128)) .buy_execution((Parent, 1u128)) .deposit_asset(All, [0u8; 32]) .build(); ``` --------- Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: command-bot <> Co-authored-by: Adrian Catangiu <adrian@parity.io>
The XCM builder pattern lets you build xcms like so:
All the
.into()
become quite annoying to have to write.I accepted
impl Into<T>
instead ofT
in the generated methods from the macro.Now the previous example can be simplified as follows: