Expand description
Provides a variant of read_exact
that succeeds on EOF if no data has been
read.
§Example
use std::io;
use std::io::prelude::*;
use std::fs::File;
use read_exact::ReadExactExt;
let mut f = try!(File::open("foo.txt"));
let mut buffer = [0; 10];
let success = try!(f.read_exact_or_eof(&mut buffer));
if success {
// buffer is full
} else {
// buffer contents unchanged, file was empty
}
Traits§
- An extension trait that applies to all
std::io::Read
types.