title: How do I create a map from a list in a functional way?
body: <p>In Scala, there is a method named <code>toMap</code> that works on any list of tuples and converts it to a map where the key is the first item on the tuple and the value is the second one:</p>
  
  <pre class="lang-scala prettyprint-override"><code>val listOfTuples = List(("one", 1), ("two", 2))
  val map = listOfTuples.toMap 
  </code></pre>
  
  <p>What is the closest thing to <code>toMap</code> in Rust?</p>