dcsv/
lib.rs

1//! # Dynamic csv manipulation library
2//!
3//! Dcsv is a dynamic csv container library which offers reading and writing features.
4//!
5//! # Basic
6//!
7//! Dcsv has two major structs of Reader and VirtualData. Reader reads csv data as byte stream and
8//! return virtual data. Changes to virtual data is not linked to original source. User needs to
9//! save virtual data to desired destination.
10//!
11//! If you want static form of data, use read_only_ref method to get data as records form.
12//!
13//! ## Usage
14//!
15//! ```no_run
16//! // It is required to import VCont trait
17//! use dcsv::VCont;
18//! use dcsv::{Reader, VirtualData, Value};
19//! use std::io::BufReader;
20//! use std::fs::File;
21//!
22//! let data: VirtualData = Reader::new()
23//!     .use_delimiter(';')      // Default is comma
24//!     .use_line_delimiter('|') // Default is '\n, \r\n'
25//!     .data_from_stream(
26//!         BufReader::new(
27//!             File::open("file_name.csv")
28//!                 .expect("Failed to read file")
29//!         )
30//!     )
31//!     .expect("Failed to retrieve csv value from file");
32//!
33//! // Refer docs.rs for various VirtualData methods
34//! let value : &Value = data.get_cell(1,1).expect("Failed to get cell");
35mod error;
36mod parser;
37mod reader;
38mod test;
39pub mod utils;
40mod value;
41mod vcont;
42mod virtual_array;
43mod virtual_data;
44
45pub use error::{DcsvError, DcsvResult};
46pub use reader::{Reader, ReaderOption};
47
48pub use value::LIMITER_ATTRIBUTE_LEN;
49pub use virtual_data::SCHEMA_HEADER;
50
51pub use value::{Value, ValueLimiter, ValueType};
52pub use vcont::VCont;
53pub use virtual_array::VirtualArray;
54pub use virtual_data::{Column, ReadOnlyData, ReadOnlyDataRef, Row, VirtualData};