Skip to content

Support Serialization and Deserialization of CSV Rows via Structs #9

@DISTREAT

Description

@DISTREAT

Feature Request

It would be valuable to support deserializing and serializing CSV rows using Zig structs, similar to how Rust's serde library allows users to define a struct and seamlessly read/write rows via those types.

Proposal:

  • Allow users to define a Zig struct that matches the columns in the CSV.
  • Implement functions/macros to read a CSV row directly into a struct and write a struct out as a CSV row.
  • This would improve type-safety, ergonomics, and reduce boilerplate for users who want to work directly with typed data.

Reference

  • Rust serde's approach (https://serde.rs/) is a relevant prior art for how struct <-> row mapping can be achieved.

Questions:

  • What should the API look like for the user?
  • Should we support field tagging/annotation for custom column names or skipping fields?
  • Does this even make sense in the first place?

This feature will greatly enhance usability for applications handling structured CSV data in Zig.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions