title: Capture variable in C callback
body: <p>I have some state <code>struct</code> in Rust and a C library that will accept and call an <code>extern "C" fn</code>.</p>
  
  <pre><code>fn get_callback(state: State) -&gt; extern "C" fn ... {
      extern "C" fn callback(args: &amp;[Whatever]) -&gt; Something {
          // I need to use that state here
      }
  
      callback
  }
  </code></pre>
  
  <p>Of course, this doesn't work because <code>callback</code> gets defined outside <code>get_callback</code> like any other C function.</p>
  
  <p>How can I have some particular state inside of the callback? I need this to add mruby callbacks to Rust and using a global variable for the state is not desirable since every mruby state has its own variable.</p>