Crate dcsv

source · []
Expand description

Dynamic csv manipulation library

Dcsv is a dynamic csv container library which offers reading and writing features.

Basic

Dcsv has two major structs of Reader and VirtualData. Reader reads csv data as byte stream and return virtual data. Changes to virtual data is not linked to original source. User needs to save virtual data to desired destination.

If you want static form of data, use read_only_ref method to get data as records form.

Usage

// It is required to import VCont trait
use dcsv::VCont;
use dcsv::{Reader, VirtualData, Value};
use std::io::BufReader;
use std::fs::File;

let data: VirtualData = Reader::new()
    .use_delimiter(';')      // Default is comma
    .use_line_delimiter('|') // Default is '\n, \r\n'
    .data_from_stream(
        BufReader::new(
            File::open("file_name.csv")
                .expect("Failed to read file")
        )
    )
    .expect("Failed to retrieve csv value from file");

// Refer docs.rs for various VirtualData methods
let value : &Value = data.get_cell(1,1).expect("Failed to get cell");

Modules

Structs

Column of virtual data

Read only data

Borrowed read only data from virtual_data

Csv Reader

Reader behaviour related options

Row

Limiter that costraints which data that Value can hold

Virtual data which contains csv information in a form of arrays.

Virtual data struct which contains csv information

Enums

Error types for dcsv related operations.

Basic component of virtual data

Type of a value

Constants

Traits

Generic trait over both virtual_data and virtual_array

Type Definitions