Hacker News new | ask | show | jobs
by atombender 2487 days ago
No, I tried that! That actually moves the "Cannot move" error to the "self.buffers" use itself.

The reason I can't just iterate by value is that I'd be consuming data that is already held by the map. The buffer is defined thus:

  use bitstream_io::{BigEndian, BitWriter};

  struct PostingBuffer<W: io::Write> {
    bw: BitWriter<W, BigEndian>,
    // ...
  }

  impl PostingBuffer {
    pub fn get_data(self) -> W {
      self.bw.into_writer()
    }
  }
bitstream_io::BitWriter's [1] into_writer consumes itself:

  pub fn into_writer(self) -> W {
    self.writer
  }
[1] https://docs.rs/bitstream-io/0.8.2/bitstream_io/write/struct...
1 comments

Ah, ah, I see now. Yes, right.

This is exactly why I couched my last paragraph the way I did, heh.