title: Global mutable HashMap in a library
body: <p>I want to have an extendable dictionary linking together <code>Object</code> with a <code>&amp;'static str</code> inside my library. <code>HashMap</code> seems like the right data structure for this, but how do I make it global, initialised on declaration and mutable?</p>
  
  <p>So something like this:</p>
  
  <pre><code>use std::collections::HashMap;
  
  enum Object { A, B, C }
  
  const OBJECT_STR: &amp;'static [&amp;'static str] = &amp;[ "a", "b", "c" ];
  
  static mut word_map: HashMap&lt;&amp;'static str, Object&gt; = {
      let mut m = HashMap::new();
      m.insert(OBJECT_STR[0], Object::A);
      m.insert(OBJECT_STR[1], Object::B);
      m.insert(OBJECT_STR[2], Object::C);
      m
  };
  
  impl Object {
  ...
  }
  </code></pre>