1 unstable release
Uses old Rust 2015
0.0.1 | Jul 11, 2016 |
---|
#7 in #eof
1,453 downloads per month
Used in 262 crates
(2 directly)
4KB
53 lines
read_exact
read_exact
provides a variant of read_exact
that succeeds on EOF if no data
has been read.
Documentation
See the documentation for up to date information.
lib.rs
:
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
}