{"id":13439274,"url":"https://github.com/BurntSushi/rust-csv","last_synced_at":"2025-03-20T07:32:51.575Z","repository":{"id":15274674,"uuid":"18004019","full_name":"BurntSushi/rust-csv","owner":"BurntSushi","description":"A CSV parser for Rust, with Serde support.","archived":false,"fork":false,"pushed_at":"2025-02-12T16:08:38.000Z","size":2914,"stargazers_count":1778,"open_issues_count":90,"forks_count":227,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-18T16:09:56.838Z","etag":null,"topics":["csv","library","rust","rust-library"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BurntSushi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["BurntSushi"]}},"created_at":"2014-03-22T06:58:51.000Z","updated_at":"2025-03-16T22:29:04.000Z","dependencies_parsed_at":"2024-11-05T18:01:51.442Z","dependency_job_id":"1e7c9c46-d8e0-467c-83e9-1308a0655049","html_url":"https://github.com/BurntSushi/rust-csv","commit_stats":{"total_commits":440,"total_committers":54,"mean_commits":8.148148148148149,"dds":"0.15000000000000002","last_synced_commit":"00b80bdb5425fe0fcf8b6ad3ae4fb4e41497d911"},"previous_names":[],"tags_count":97,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntSushi%2Frust-csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntSushi%2Frust-csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntSushi%2Frust-csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntSushi%2Frust-csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BurntSushi","download_url":"https://codeload.github.com/BurntSushi/rust-csv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244571025,"owners_count":20474167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","library","rust","rust-library"],"created_at":"2024-07-31T03:01:12.573Z","updated_at":"2025-03-20T07:32:46.566Z","avatar_url":"https://github.com/BurntSushi.png","language":"Rust","readme":"csv\n===\nA fast and flexible CSV reader and writer for Rust, with support for Serde.\n\n[![Build status](https://github.com/BurntSushi/rust-csv/workflows/ci/badge.svg)](https://github.com/BurntSushi/rust-csv/actions)\n[![crates.io](https://img.shields.io/crates/v/csv.svg)](https://crates.io/crates/csv)\n\nDual-licensed under MIT or the [UNLICENSE](http://unlicense.org).\n\n\n### Documentation\n\nhttps://docs.rs/csv\n\nIf you're new to Rust, the\n[tutorial](https://docs.rs/csv/1.*/csv/tutorial/index.html)\nis a good place to start.\n\n\n### Usage\n\nTo bring this crate into your repository, either add `csv` to your\n`Cargo.toml`, or run `cargo add csv`.\n\n\n### Example\n\nThis example shows how to read CSV data from stdin and print each record to\nstdout.\n\nThere are more examples in the\n[cookbook](https://docs.rs/csv/1.*/csv/cookbook/index.html).\n\n```rust\nuse std::{error::Error, io, process};\n\nfn example() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    // Build the CSV reader and iterate over each record.\n    let mut rdr = csv::Reader::from_reader(io::stdin());\n    for result in rdr.records() {\n        // The iterator yields Result\u003cStringRecord, Error\u003e, so we check the\n        // error here.\n        let record = result?;\n        println!(\"{:?}\", record);\n    }\n    Ok(())\n}\n\nfn main() {\n    if let Err(err) = example() {\n        println!(\"error running example: {}\", err);\n        process::exit(1);\n    }\n}\n```\n\nThe above example can be run like so:\n\n```text\n$ git clone git://github.com/BurntSushi/rust-csv\n$ cd rust-csv\n$ cargo run --example cookbook-read-basic \u003c examples/data/smallpop.csv\n```\n\n### Example with Serde\n\nThis example shows how to read CSV data from stdin into your own custom struct.\nBy default, the member names of the struct are matched with the values in the\nheader record of your CSV data.\n\n```rust\nuse std::{error::Error, io, process};\n\n#[derive(Debug, serde::Deserialize)]\nstruct Record {\n    city: String,\n    region: String,\n    country: String,\n    population: Option\u003cu64\u003e,\n}\n\nfn example() -\u003e Result\u003c(), Box\u003cdyn Error\u003e\u003e {\n    let mut rdr = csv::Reader::from_reader(io::stdin());\n    for result in rdr.deserialize() {\n        // Notice that we need to provide a type hint for automatic\n        // deserialization.\n        let record: Record = result?;\n        println!(\"{:?}\", record);\n    }\n    Ok(())\n}\n\nfn main() {\n    if let Err(err) = example() {\n        println!(\"error running example: {}\", err);\n        process::exit(1);\n    }\n}\n```\n\nThe above example can be run like so:\n\n```\n$ git clone git://github.com/BurntSushi/rust-csv\n$ cd rust-csv\n$ cargo run --example cookbook-read-serde \u003c examples/data/smallpop.csv\n```\n","funding_links":["https://github.com/sponsors/BurntSushi"],"categories":["Libraries","Rust","代码","库 Libraries","库","File Processing","虚拟化"],"sub_categories":["Encoding","编码","编码 Encoding","编码(Encoding)","加密 Encoding"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBurntSushi%2Frust-csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBurntSushi%2Frust-csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBurntSushi%2Frust-csv/lists"}