title: how to send a closure with captures through the mpsc channel in rust?
body: <p>I would like to implement an executor that can execute the packaged tasks in queue. Firstly, I
  hope to make different types of functions into one type using a closure, and send the closure into a channel, then receive and execute it in another thread. The codes are below :</p>
  <pre><code>use std::thread;
  use std::sync::mpsc;
  macro_rules! packed_task {    
      ($f:ident, $($arg:expr),*) =&gt; {move ||{
          $f($($arg,)*)
      }};
  }
  macro_rules! packed_method_task {
      ($f:ident,$ins:ident, $($arg:expr),*) =&gt; {move ||{
          $ins.$f($($arg,)*);
      }};
      ($f:ident,$ins:ident $($arg:expr),*) =&gt; {move ||{
           $ins.$f($($arg,)*);
      }};
  }
  #[derive(Debug)]
  struct Rectangle {
      width: u32,
      height: u32,
  }
  
  impl Rectangle {
      fn area(&amp;self) -&gt; u32 {
          self.width * self.height
      }
      fn area1(&amp;self, w:u32, h:u32) -&gt; u32 {
          w*h
      }
  }
  fn invoke_1(a:i32, b:i32, c:i32)-&gt;i32{
      let fc = |x,y,z| x+y+z + 1;
      return packed_task!(fc, a, b,c)();
  }
  
  fn main() {
      println!(&quot;{}&quot;, invoke_1(1,2,3));
      let rect1 = Rectangle { width: 30, height: 50 };
      let b = packed_method_task!(area1, rect1, 60, 90);
      let (tx, rx) = mpsc::channel();
      
      let handle= thread::spawn(move || {
          let _received = rx.recv().unwrap();
          _received();
      });
      
      tx.send(b).unwrap();
      handle.join();
  }
  
  </code></pre>
  <p>But I compile with errors:</p>
  <pre><code>|     let (tx, rx) = mpsc::channel();
     |         -------- consider giving this pattern the explicit type `(Sender&lt;T&gt;, std::sync::mpsc::Receiver&lt;T&gt;)`, with the type parameters 
  specified
  </code></pre>
  <p>how can I achieve this?</p>