1 unstable release

Uses old Rust 2015

0.0.1 Jul 11, 2016

#5 in #eof

Download history 253/week @ 2024-02-14 338/week @ 2024-02-21 239/week @ 2024-02-28 172/week @ 2024-03-06 186/week @ 2024-03-13 278/week @ 2024-03-20 773/week @ 2024-03-27 274/week @ 2024-04-03 339/week @ 2024-04-10 351/week @ 2024-04-17 409/week @ 2024-04-24 606/week @ 2024-05-01 357/week @ 2024-05-08 449/week @ 2024-05-15 353/week @ 2024-05-22 329/week @ 2024-05-29

1,560 downloads per month
Used in 260 crates (2 directly)

MIT license

4KB
53 lines

read_exact

travis-badge release-badge docs-badge license-badge

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
}

No runtime deps