Unverified Commit c130ea99 authored by Francisco Aguirre's avatar Francisco Aguirre Committed by GitHub
Browse files

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: default avatarBastian Köcher <[email protected]>
Co-authored-by: command-bot <>
Co-authored-by: default avatarAdrian Catangiu <[email protected]>
parent bcb4d137
Pipeline #462291 passed with warnings with stages
in 58 minutes and 36 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment