Crates.io | csvtoron |
lib.rs | csvtoron |
version | 0.2.0 |
source | src |
created_at | 2022-01-30 13:04:44.283868 |
updated_at | 2022-01-30 13:04:44.283868 |
description | converting csv file to the ron format |
homepage | |
repository | https://github.com/hartmut/csvtoron |
max_upload_size | |
id | 524031 |
size | 13,371 |
Project to automatically convert csv files to ron. Inspired by the project toml_to_ron.
For usage take a look into the example directory or just call
to_ron(filename)
in the library. The return value is
Result<(), String>
For issues and problems please go to github.
use std::env;
use csvtoron::to_ron;
fn main() -> Result<(), String> {
let args: Vec<String> = env::args().collect();
if args.len() != 2 {
return Err("Usage is : ./csvtoron <filename>".to_string());
}
let filename = args.get(1).unwrap();
to_ron(filename)
}
The the cells will be interpreted as f64, u64 and string and put into the output file acordingly.
The Output format is as follows:
(
content: [
{
"head of column 1": "String value of line 1 column 1",
"head of column 2": 0.426, //f64
"head of column 3": "String Value",
"head of column 4": 713, //u64
}
{
content of second line
}
..
]
)