1 unstable release

Uses old Rust 2015

0.0.1 Jul 11, 2016

#26 in #full

Download history 316/week @ 2024-12-24 134/week @ 2024-12-31 286/week @ 2025-01-07 329/week @ 2025-01-14 269/week @ 2025-01-21 261/week @ 2025-01-28 264/week @ 2025-02-04 289/week @ 2025-02-11 230/week @ 2025-02-18 355/week @ 2025-02-25 193/week @ 2025-03-04 327/week @ 2025-03-11 356/week @ 2025-03-18 322/week @ 2025-03-25 172/week @ 2025-04-01 206/week @ 2025-04-08

1,114 downloads per month
Used in 262 crates (2 directly)

MIT license

4KB
53 lines

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
}

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.

No runtime deps