std::io::mem: add a with_capacity constructor to MemWriter.

This allows one to reduce the number of reallocs of the internal buffer
if one has an approximate idea of the size of the final output.