BurntSushi / Rust Csv
Licence: other
A CSV parser for Rust, with Serde support.
Stars: ✭ 911
Programming Languages
rust
11053 projects
Labels
Projects that are alternatives of or similar to Rust Csv
Ta Rs
Technical analysis library for Rust language
Stars: ✭ 248 (-72.78%)
Mutual labels: library, rust-library
Grammers
(tele)gramme.rs - use Telegram's API from Rust
Stars: ✭ 109 (-88.04%)
Mutual labels: library, rust-library
Kbcsv
KBCsv is an efficient, easy to use .NET parsing and writing library for the CSV (comma-separated values) format.
Stars: ✭ 75 (-91.77%)
Mutual labels: csv, library
Csv2ofx
A Python library and command line tool for converting csv to ofx and qif files
Stars: ✭ 133 (-85.4%)
Mutual labels: csv, library
Dumpling
Dumpling is a fast, easy-to-use tool written by Go for dumping data from the database(MySQL, TiDB...) to local/cloud(S3, GCP...) in multifarious formats(SQL, CSV...).
Stars: ✭ 134 (-85.29%)
Mutual labels: csv, library
Timesheet.js
JavaScript library for HTML5 & CSS3 time sheets
Stars: ✭ 6,881 (+655.32%)
Mutual labels: library
Androidlibs
🔥正在成为史上最全分类 Android 开源大全~~~~(长期更新 Star 一下吧)
Stars: ✭ 7,148 (+684.63%)
Mutual labels: library
Ambient
Lightweight ambient light javascript library for HTML image and video elements
Stars: ✭ 20 (-97.8%)
Mutual labels: library
Printcess
Haskell pretty printing library supporting indentation, mixfix operators, and automatic line breaks.
Stars: ✭ 13 (-98.57%)
Mutual labels: library
Honeyjs
An open source Javascript Honey Pot implementation
Stars: ✭ 20 (-97.8%)
Mutual labels: library
Humblelogging
HumbleLogging is a lightweight C++ logging framework. It aims to be extendible, easy to understand and as fast as possible.
Stars: ✭ 15 (-98.35%)
Mutual labels: library
csv
A fast and flexible CSV reader and writer for Rust, with support for Serde.
Dual-licensed under MIT or the UNLICENSE.
Documentation
If you're new to Rust, the tutorial is a good place to start.
Usage
Add this to your Cargo.toml
:
[dependencies]
csv = "1.1"
Example
This example shows how to read CSV data from stdin and print each record to stdout.
There are more examples in the cookbook.
use std::error::Error;
use std::io;
use std::process;
fn example() -> Result<(), Box<dyn Error>> {
// Build the CSV reader and iterate over each record.
let mut rdr = csv::Reader::from_reader(io::stdin());
for result in rdr.records() {
// The iterator yields Result<StringRecord, Error>, so we check the
// error here.
let record = result?;
println!("{:?}", record);
}
Ok(())
}
fn main() {
if let Err(err) = example() {
println!("error running example: {}", err);
process::exit(1);
}
}
The above example can be run like so:
$ git clone git://github.com/BurntSushi/rust-csv
$ cd rust-csv
$ cargo run --example cookbook-read-basic < examples/data/smallpop.csv
Example with Serde
This example shows how to read CSV data from stdin into your own custom struct. By default, the member names of the struct are matched with the values in the header record of your CSV data.
use std::error::Error;
use std::io;
use std::process;
use serde::Deserialize;
#[derive(Debug, Deserialize)]
struct Record {
city: String,
region: String,
country: String,
population: Option<u64>,
}
fn example() -> Result<(), Box<dyn Error>> {
let mut rdr = csv::Reader::from_reader(io::stdin());
for result in rdr.deserialize() {
// Notice that we need to provide a type hint for automatic
// deserialization.
let record: Record = result?;
println!("{:?}", record);
}
Ok(())
}
fn main() {
if let Err(err) = example() {
println!("error running example: {}", err);
process::exit(1);
}
}
The above example can be run like so:
$ git clone git://github.com/BurntSushi/rust-csv
$ cd rust-csv
$ cargo run --example cookbook-read-serde < examples/data/smallpop.csv
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].