stdlib: Add io::writer.write_line
This commit is contained in:
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user