Closed
Description
MemWriter recently lost its ability to seek due to speed concerns, which removed any way of resetting/truncating it (i.e. seeking backwards). Could this be added? A possible API/implementation would be:
// Does nothing if new_len is greater than current length
pub fn truncate(&mut self, new_len: uint) { self.buf.truncate(new_len); }
Alternatively, perhaps a new constructor could be added which would wrap an existing Vec
which would allow me to do this:
let writer = MemWriter::new();
let mut vec = writer.unwrap();
vec.truncate(new_len);
let writer = MemWriter::wrap(vec);
@erickt, I recall talking to you about this on IRC, so you may have some thoughts.
Metadata
Metadata
Assignees
Labels
No labels