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.