dd_lib/io/mod.rs
1//! Reading, writing, and manipulating bytes.
2//!
3//! In this module, we use the following type shorthands:
4//! - R is the [`Reader`]: for dd, this is either [`Stdin`][std::io::StdinLock]
5//! or a
6//! [`File`][std::fs::File]
7//! - W is the [`Writer`]: for dd, this is either [std::io::StdoutLock]
8//! or a [`File`][std::fs::File]
9//! - C is a [`ConvertSlice`], which modifies a slice of bytes in-place. During
10//! operation, this is always a [`Converter`]
11//! - E is the [`ErrHandler`]. During operation, this is [std::io::StderrLock].
12
13/// copy bytes from a [`Reader`] to a [`Writer`]
14/// converting them according to a [`Converter`]
15pub mod copy;
16
17mod conv;
18mod errhandler;
19mod read;
20mod write;
21
22#[cfg(test)]
23mod tests;
24
25/// [`Converter`] encodes a slice to the specified encoding,
26/// changes the case (if applicable), and/or swaps pairs of bytes,
27/// according to the conversion flags and conversion block size specified in
28/// [`opts`]
29pub use self::conv::Converter;
30
31/// [`ErrHandler`] handles errors, writing errors and/or perodic reports to the
32/// speicifed file or stderr. see [`StatusLevel`] and
33/// [`NOERROR`][CFlag]
34pub use self::errhandler::ErrHandler;
35
36/// [`Reader`] reads from the specified file or stdin, according
37/// to the options specified in `opts`
38pub use self::read::Reader;
39
40/// [`Writer`] writes to the specified file or stdout, according
41/// to the options specified in `opts`
42pub use self::write::Writer;
43
44pub use self::conv::ConvertSlice;
45
46#[allow(unused_imports)]
47use opts::{self, CFlag, StatusLevel};