Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSerialize records to CSV #250
Conversation
alisha17
force-pushed the
alisha17:serialize_csv
branch
from
acfa52f
to
5fb10dc
Jul 16, 2017
This comment has been minimized.
This comment has been minimized.
|
Looks good. Instead of doing two examples under one section, can you split it into two sections please? Call the second |
This comment has been minimized.
This comment has been minimized.
|
This also needs a rebase because of the merge conflict. |
alisha17
force-pushed the
alisha17:serialize_csv
branch
2 times, most recently
from
6616d81
to
82e1dd8
Jul 20, 2017
budziq
requested changes
Jul 20, 2017
|
very nice! just some final touches |
|
|
||
| [![csv-badge]][csv] [![cat-encoding-badge]][cat-encoding] | ||
|
|
||
| CSV writer supports automatic serialization from Rust types into CSV |
This comment has been minimized.
This comment has been minimized.
|
|
||
| ```rust | ||
| # #[macro_use] | ||
| #extern crate error_chain; |
This comment has been minimized.
This comment has been minimized.
|
|
||
| ```rust | ||
| # #[macro_use] | ||
| #extern crate error_chain; |
This comment has been minimized.
This comment has been minimized.
| # } | ||
| #[derive(Debug, Serialize)] | ||
| #[serde(rename_all = "PascalCase")] |
This comment has been minimized.
This comment has been minimized.
budziq
Jul 20, 2017
Collaborator
if the rename is important here please describe why and link to docs in the description if not then please remove it.
| let mut wtr = csv::Writer::from_writer(io::stdout()); | ||
| wtr.serialize(Record { | ||
| name: "Mark", |
This comment has been minimized.
This comment has been minimized.
budziq
Jul 20, 2017
Collaborator
how about providing a constructor for Record to make the example less verbose
| } | ||
| fn run() -> Result<()> { | ||
| let mut wtr = csv::Writer::from_writer(io::stdout()); |
This comment has been minimized.
This comment has been minimized.
budziq
Jul 20, 2017
Collaborator
i would mention the key identifiers (not described in previous exame) in description linking to the docs
| [![csv-badge]][csv] [![serde-badge]][serde] [![cat-encoding-badge]][cat-encoding] | ||
|
|
||
| The following example shows how to serialize custom structs as CSV records. For this, | ||
| make use of the [serde] crate. |
This comment has been minimized.
This comment has been minimized.
budziq
Jul 20, 2017
Collaborator
I would remove the last sentence and just mention serde in the first sentence.
| fn run() -> Result<()> { | ||
| let mut wtr = csv::Writer::from_writer(io::stdout()); | ||
| wtr.write_record(&["Name", "Place", "ID"])?; |
This comment has been minimized.
This comment has been minimized.
budziq
Jul 20, 2017
Collaborator
please mention the key identifiers in the description linking to the docs
alisha17
force-pushed the
alisha17:serialize_csv
branch
from
3f6ee76
to
1515289
Jul 23, 2017
budziq
approved these changes
Jul 23, 2017
brson
merged commit 7fa8270
into
rust-lang-nursery:master
Jul 25, 2017
1 check passed
This comment has been minimized.
This comment has been minimized.
|
Thanks @alisha17 |
alisha17 commentedJul 16, 2017
Fixes #232