stdlib: Add io::writer.write_line

This commit is contained in:
Brian Anderson
2011-05-13 16:35:16 -04:00
parent fc8b9671bb
commit 01c13a3878

View File

@@ -356,6 +356,7 @@ type writer =
// write_str will continue to do utf-8 output only. an alternative
// function will be provided for general encoded string output
fn write_str(str s);
fn write_line(str s);
fn write_char(char ch);
fn write_int(int n);
fn write_uint(uint n);
@@ -392,6 +393,10 @@ state obj new_writer(buf_writer out) {
fn write_str(str s) {
out.write(str::bytes(s));
}
fn write_line(str s) {
out.write(str::bytes(s));
out.write(str::bytes("\n"));
}
fn write_char(char ch) {
// FIXME needlessly consy
out.write(str::bytes(str::from_char(ch)));