Struct std::old_io::BufWriterUnstable [-] [+] [src]

pub struct BufWriter<'a> {
    // some fields omitted
}

Writes to a fixed-size byte slice

If a write will not fit in the buffer, it returns an error and does not write any data.

Example

fn main() { #![allow(unused_must_use)] use std::old_io::BufWriter; let mut buf = [0; 4]; { let mut w = BufWriter::new(&mut buf); w.write(&[0, 1, 2]); } assert!(buf == [0, 1, 2, 0]); }
use std::old_io::BufWriter;

let mut buf = [0; 4];
{
    let mut w = BufWriter::new(&mut buf);
    w.write(&[0, 1, 2]);
}
assert!(buf == [0, 1, 2, 0]);

Methods

impl<'a> BufWriter<'a>

fn new(buf: &'a mut [u8]) -> BufWriter<'a>

Creates a new BufWriter which will wrap the specified buffer. The writer initially starts at position 0.

Trait Implementations

impl<'a> Writer for BufWriter<'a>

fn write_all(&mut self, src: &[u8]) -> IoResult<()>

fn write(&mut self, buf: &[u8]) -> IoResult<()>

fn flush(&mut self) -> IoResult<()>

fn write_fmt(&mut self, fmt: Arguments) -> IoResult<()>

fn write_str(&mut self, s: &str) -> IoResult<()>

fn write_line(&mut self, s: &str) -> IoResult<()>

fn write_char(&mut self, c: char) -> IoResult<()>

fn write_int(&mut self, n: isize) -> IoResult<()>

fn write_uint(&mut self, n: usize) -> IoResult<()>

fn write_le_uint(&mut self, n: usize) -> IoResult<()>

fn write_le_int(&mut self, n: isize) -> IoResult<()>

fn write_be_uint(&mut self, n: usize) -> IoResult<()>

fn write_be_int(&mut self, n: isize) -> IoResult<()>

fn write_be_u64(&mut self, n: u64) -> IoResult<()>

fn write_be_u32(&mut self, n: u32) -> IoResult<()>

fn write_be_u16(&mut self, n: u16) -> IoResult<()>

fn write_be_i64(&mut self, n: i64) -> IoResult<()>

fn write_be_i32(&mut self, n: i32) -> IoResult<()>

fn write_be_i16(&mut self, n: i16) -> IoResult<()>

fn write_be_f64(&mut self, f: f64) -> IoResult<()>

fn write_be_f32(&mut self, f: f32) -> IoResult<()>

fn write_le_u64(&mut self, n: u64) -> IoResult<()>

fn write_le_u32(&mut self, n: u32) -> IoResult<()>

fn write_le_u16(&mut self, n: u16) -> IoResult<()>

fn write_le_i64(&mut self, n: i64) -> IoResult<()>

fn write_le_i32(&mut self, n: i32) -> IoResult<()>

fn write_le_i16(&mut self, n: i16) -> IoResult<()>

fn write_le_f64(&mut self, f: f64) -> IoResult<()>

fn write_le_f32(&mut self, f: f32) -> IoResult<()>

fn write_u8(&mut self, n: u8) -> IoResult<()>

fn write_i8(&mut self, n: i8) -> IoResult<()>

impl<'a> Seek for BufWriter<'a>

fn tell(&self) -> IoResult<u64>

fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()>