zicsv

Crates.iozicsv
lib.rszicsv
version0.1.0
sourcesrc
created_at2018-04-26 01:44:42.13647
updated_at2018-04-26 01:44:42.13647
descriptionParser library for Zapret-Info CSV lists
homepage
repositoryhttps://github.com/im-0/zicsv
max_upload_size
id62328
size38,983
Ivan Mironov (im-0)

documentation

https://docs.rs/crate/zicsv

README

crates.io

zicsv

zicsv - Parser library for Zapret-Info CSV lists.

Documentation on docs.rs

Features:

  • Stream parser.
  • Immunity to malformed data which sometimes appears in Zapret-Info dumps.

Usage

Add this into your Cargo.toml:

[dependencies]
zicsv = "0.1"

Example code:

extern crate zicsv;

fn main() {
    use zicsv::GenericReader;

    let mut reader = zicsv::Reader::from_file("dump.csv").expect("Unable to create zicsv::Reader");

    println!("Timestamp: {}", reader.get_timestamp());
    println!();

    let mut errors = false;
    for record in reader.iter() {
        match record {
            Ok(record) => println!("{}", record),

            Err(error) => {
                errors = true;
                eprintln!("ERROR: {}", error);
            },
        }
    }

    std::process::exit(if errors { 1 } else { 0 })
}

Download dump.csv manually or use download-dump script from this repository before running this example.

Running examples

git clone --branch b0.1.0 https://github.com/im-0/zicsv
cd zicsv
./download-dump
cargo run --package zicsv --example parse
Commit count: 49

cargo fmt