std: add OutStream.write_byte

This commit is contained in:
Andrew Kelley 2016-07-26 18:13:22 -07:00
parent 78d4fb20c4
commit 76f87cdd96

View File

@ -63,6 +63,12 @@ pub struct OutStream {
buffer: [buffer_size]u8,
index: isize,
pub fn write_byte(os: &OutStream, b: u8) -> %void {
if (os.buffer.len == os.index) %return os.flush();
os.buffer[os.index] = b;
os.index += 1;
}
pub fn write(os: &OutStream, bytes: []const u8) -> %isize {
var src_bytes_left = bytes.len;
var src_index: @typeof(bytes.len) = 0;