1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! This crate provides utilities to concatenate files.
//!
//! To use this crate, add `fcc` as a dependency to your project's `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! fcc = "0.3"
//! ```
//!
//!
//! # Example
//!
//! The core functionality of this crate is provided by [`Concat`] type builder.
//!
//! The following example concatenates a list of csv files with some tweaks and
//! prints the result:
//!
//! ```no_run
//! use fcc::{Concat, Result};
//!
//! fn main() -> Result<()> {
//!     let files = vec!("foo.csv", "bar.csv", "baz.csv");
//!
//!     let mut concat = Concat::new()
//!         .newline(true) // appends a '\n' to each file if the file does not ends with '\n'
//!         .header(true) // extracts the headers from each file
//!         .skip_end(1) // skips last line when concatenating
//!         .pad_with(b"---end of file---\n") // fills some paddings after each file
//!         .open(files);
//!
//!     concat.write(&mut std::io::stdout())?;
//!
//!     Ok(())
//! }
//!
//! ```
//!
//! [`Concat`]: struct.Concat.html
#![deny(missing_docs)]

mod error;
pub use error::{Error, ErrorKind, Result};

mod concat;
pub use concat::{ByteSeeker, Concat};

mod util;
pub use util::{ends_with_newline, get_last_byte};