title: rust image post request
body: <p>I use qrcode-rust which returns its result as image::ImageBuffer. I need to post the png result to thumbor server. How to convert this image buffer to Vec  ?.</p>
  
  <p>I try code below but my <code>buf</code> moved and I can do nothing about it.</p>
  
  <pre><code>let code = QrCode::new(arg1.as_bytes()).unwrap();
  let images = code.render::&lt;Luma&lt;u8&gt;&gt;().build();
  let mut buf: Vec&lt;u8&gt; = Vec::new();
  let dims = images.dimensions();
  let mut headers = HeaderMap::new();
  
  image::png::PNGEncoder::new(buf)
      .encode(&amp;images.into_raw(), dims.0, dims.1, ColorType::Gray(8))
      .expect("Error on encoding to png");
  
  let len = buf.len(); //error here
  headers.insert(CONTENT_TYPE, "image/png".parse().unwrap());
  headers.insert("Slug", "photo.jpg".parse().unwrap());
  </code></pre>