title: Passing callback into tokio task
body: <p>I have a function that takes a callback as a parameter:</p>
  
  <pre><code>fn my_function (on_complete: Box&lt;dyn FnOnce(bool)) {
      // Do some work
      on_complete(false);
  }
  </code></pre>
  
  <p>The work I do before calling is pretty heavy though, so I'm trying to spawn it off into a task:</p>
  
  <pre><code>fn my_function (on_complete: Box&lt;dyn FnOnce(bool)) {
      tokio::spawn(async move{
          // Do some work
          on_complete(false);
      });
  }
  </code></pre>
  
  <p>This is giving me all sorts of ownership issues, namely that my Box can't be safely shared across threads. I've tried a number of things to get around this, including obvious ones like borrowing and more traditional threading solutions like passing it as an Arc>, but can't seem to get anywhere.</p>
  
  <p>Any suggestions on how to do this correctly?</p>