To combine two maps, you can use the extend
method or the insert
method. Here is an example using extend
:
main.rs310 chars13 lines
This will produce the following output:
main.rs44 chars2 lines
Alternatively, you can use the insert
method to add each key-value pair from one map to the other:
main.rs358 chars16 lines
This will produce the same output as before:
main.rs44 chars2 lines
gistlibby LogSnag