io_test_util/lib.rs
1//! Collection of utilities for testing failure of io components, e.g. `std::io::Read`.
2//!
3//! # Usage
4//!
5//! ### In your Cargo.toml:
6//!
7//! ```toml
8//! [dev-dependencies]
9//! io-test-util = "*"
10//! ```
11//!
12//! ### In your test:
13//!
14//! ```
15//! extern crate io_test_util;
16//! use io_test_util::ErrReader;
17//! use std::io::{ErrorKind, Read};
18//!
19//! pub fn main() {
20//! let mut reader = ErrReader::new(ErrorKind::BrokenPipe);
21//! let res = reader.read(&mut[0; 1]);
22//! assert!(res.is_err());
23//! }
24//! ```
25
26mod error_reader;
27
28pub use self::error_reader::ErrReader;