XCM builder pattern improvement - Accept `impl Into<T>` instead of just `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>
Showing
- polkadot/xcm/pallet-xcm/src/tests/mod.rs 2 additions, 3 deletionspolkadot/xcm/pallet-xcm/src/tests/mod.rs
- polkadot/xcm/procedural/src/builder_pattern.rs 12 additions, 6 deletionspolkadot/xcm/procedural/src/builder_pattern.rs
- polkadot/xcm/procedural/tests/builder_pattern.rs 7 additions, 7 deletionspolkadot/xcm/procedural/tests/builder_pattern.rs
- polkadot/xcm/src/v4/location.rs 7 additions, 0 deletionspolkadot/xcm/src/v4/location.rs
- prdoc/pr_3708.prdoc 31 additions, 0 deletionsprdoc/pr_3708.prdoc
Please register or sign in to comment