[][src]Crate fcc

This crate provides utilities to concatenate files.

To use this crate, add fcc as a dependency to your project's Cargo.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:

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(())
}

Structs

ByteSeeker

A Seeker walks through anything that implements Read and Seek to find the position of a certain byte.

Concat

A structure for configuring how files are concatenated.

Error

An error that can occur when using fcc.

Enums

ErrorKind

The specific type of an error.

Functions

ends_with_newline

Checks if a given file ends with newline.

get_last_byte

Returns the last byte of a file, an in-memory cursor, or anything that implements Read and Seek.

Type Definitions

Result

A type alias for Result<T, fcc::Error>.