1 unstable release

Uses old Rust 2015

0.0.1 Jul 11, 2016

#6 in #eof

Download history 533/week @ 2024-07-20 302/week @ 2024-07-27 379/week @ 2024-08-03 300/week @ 2024-08-10 381/week @ 2024-08-17 351/week @ 2024-08-24 363/week @ 2024-08-31 398/week @ 2024-09-07 374/week @ 2024-09-14 514/week @ 2024-09-21 371/week @ 2024-09-28 147/week @ 2024-10-05 430/week @ 2024-10-12 286/week @ 2024-10-19 431/week @ 2024-10-26 248/week @ 2024-11-02

1,408 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