mozilla/rust — pull request #8089 by blake2-ppc (2013-07-28 12:29:13+00:00)
Title: Add .write_str() to std::rt::io, and port to rt::io for libstd Repr and ToStr

Port libstd Repr to use rt::io, and add a writer method to ToStr that uses rt::io::StringWriter

StringWriter implements .write_char(), .write_str(), .write_line().

Is a separate utility trait since it can be separately useful without
the full Writer trait.

Add a method called .to_str_writer(w: &mut W)
to ToStr. Allow passing down a string writer, that will make recursive
calls to ToStr more efficient once .to_str_writer() is implemented
widely.

.to_str() and .to_str_writer() call each other in the
default implementation. The implementer must implement at least one of
these methods.

Also port std::repr to use StringWriter. It's not as pretty since we have to replace old `@Writer` with `@mut W` where W is a generic writer.