Crates.io | readervzrd |
lib.rs | readervzrd |
version | 0.1.1 |
source | src |
created_at | 2024-02-15 08:32:40.66575 |
updated_at | 2024-10-21 13:06:28.922419 |
description | A generic reader for csv and json data |
homepage | |
repository | https://github.com/datavzrd/readervzrd/ |
max_upload_size | |
id | 1140790 |
size | 23,590 |
Readervzrd is a Rust library that provides utilities for reading tabular data from files without worrying if they are formatted as CSV or JSON. It offers flexible functionality to extract headers and iterate over records, supporting different file formats and structures.
To use readervzrd in your Rust project, add it as a dependency in your Cargo.toml file:
[dependencies]
readervzrd = "0.1.0"
use readervzrd::{FileReader, FileError};
fn main() -> Result<(), FileError> {
// Create a FileReader for a CSV file with ',' delimiter
let mut reader = FileReader::new("data.csv", Some(','))?;
// Create another FileReader for a JSON file
let mut another_reader = FileReader::new("data.json", None)?;
// Get headers from the file
let headers = reader.headers()?;
println!("Headers: {:?}", headers);
// Iterate over records and process them
for record in reader.records()? {
println!("Record: {:?}", record);
}
Ok(())
}
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or create a pull request on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.