Add with_mem_writer to std::rt::io::mem.

This is in many ways a replacement for the current
std::io::with_str_writer.
auto merge of #9038 : singingboyo/rust/with-mem-writer, r=anasazi

This is in many ways a replacement for the current std::io::with_str_writer.