Crate czv

Source
Expand description

§czv

CSV operations library for data engineering/analysis tasks.

§Example

Let’s say we want to print the total number of non-header rows in our data:

use czv::{RowCount, Result};

fn main() -> Result<()> {
    let data = "\
fruits,price
apple,2.50
banana,3.00
strawberry,1.50
";
    let output = RowCount::new().file_data(data).execute()?;
    println!("{output}"); // 3
    Ok(())
}

§Usage

It is recommended to use the builder structs rather than functions though both are provided.

The builder structs are provided at the top-level for ease of use.

For example use the czv::RowCount struct rather than the czv::count::row_count function.

Modules§

count
Counting operations including row count and column count.

Macros§

bail
Function-like macro you may pass a &str to return a czv::CzvError.

Structs§

ColumnCount
Returns a count of the total number of columns (fields).
CzvError
Extract a section of rows. Common catch-all error type based on anyhow::Error.
RowCount
Returns a count of the total number of rows.

Type Aliases§

Result
Common Result type based on anyhow::Result and czv::CzvError.