fn simple_cat<F: Read>(&self, file: &mut F, stdout: &mut StdoutLock, stderr: &mut Stderr) {
        let mut buf: [u8; 8*8192] = [0; 8*8192]; // 64K seems to be the sweet spot for a buffer on my machine.
        loop {
            let n_read = file.read(&mut buf).try(stderr);
            if n_read == 0 { // We've reached the end of the input
                break;
            }
            stdout.write_all(&buf[..n_read]).try(stderr);
        }
    }
/// A simple cat that runs a lot faster than self.cat() due to no iterators over single bytes.
A simple cat that runs a lot faster than self.cat() due to no iterators over single bytes.
A simple cat that runs a lot faster than self . cat () due to no iterators over single bytes .
fn simple_cat<F: Read>(&self, file: &mut F, stdout: &mut StdoutLock, stderr: &mut Stderr) {
        let mut buf: [u8; 8*8192] = [0; 8*8192]; // 64K seems to be the sweet spot for a buffer on my machine.
        loop {
            let n_read = file.read(&mut buf).try(stderr);
            if n_read == 0 { // We've reached the end of the input
                break;
            }
            stdout.write_all(&buf[..n_read]).try(stderr);
        }
    }
fn simple_cat < F : Read > ( & self , file : & mut F , stdout : & mut StdoutLock , stderr : & mut Stderr ) { let mut buf : [ u8 ; 8 * 8192 ] = [ 0 ; 8 * 8192 ] ; // 64K seems to be the sweet spot for a buffer on my machine. loop { let n_read = file . read ( & mut buf ) . try ( stderr ) ; if n_read == 0 { // We've reached the end of the input break ; } stdout . write_all ( & buf [ .. n_read ] ) . try ( stderr ) ; } }
A simple cat that runs a lot faster than self.cat() due to no iterators over single bytes.
A simple cat that runs a lot faster than self . cat () due to no iterators over single bytes .
&self
file
&mut F
stdout
&mut StdoutLock
stderr
&mut Stderr