Restore Writer.write_char, see #10861.
This commit is contained in:
@@ -284,6 +284,7 @@ Out of scope
|
||||
#[allow(missing_doc)];
|
||||
|
||||
use cast;
|
||||
use char::Char;
|
||||
use condition::Guard;
|
||||
use container::Container;
|
||||
use int;
|
||||
@@ -902,6 +903,13 @@ pub trait Writer {
|
||||
self.write(['\n' as u8]);
|
||||
}
|
||||
|
||||
/// Write a single char, encoded as UTF-8.
|
||||
fn write_char(&mut self, c: char) {
|
||||
let mut buf = [0u8, ..4];
|
||||
let n = c.encode_utf8(buf.as_mut_slice());
|
||||
self.write(buf.slice_to(n));
|
||||
}
|
||||
|
||||
/// Write the result of passing n through `int::to_str_bytes`.
|
||||
fn write_int(&mut self, n: int) {
|
||||
int::to_str_bytes(n, 10u, |bytes| self.write(bytes))
|
||||
|
||||
Reference in New Issue
Block a user