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§

utils
Utility methods

Structs§

Column
Column of virtual data
ReadOnlyData
Read only data
ReadOnlyDataRef
Borrowed read only data from virtual_data
Reader
Csv Reader
ReaderOption
Reader behaviour related options
Row
Row
ValueLimiter
Limiter that costraints which data that Value can hold
VirtualArray
Virtual array which contains csv information in a form of arrays.
VirtualData
Virtual data struct which contains csv information

Enums§

DcsvError
Error types for dcsv related operations.
Value
Basic component of virtual data
ValueType
Type of a value

Constants§

LIMITER_ATTRIBUTE_LEN
Length of limiter’s attributes
SCHEMA_HEADER
Header for csv schema

Traits§

VCont
Generic trait over both virtual_data and virtual_array

Type Aliases§

DcsvResult
Result of dcsv operations