Crate csv_codegen

Crate csv_codegen 

Source
Expand description

§csv-codegen

A Rust procedural macro for generating code from CSV data at compile time. Transform CSV files into Rust constants, functions, structs, and other code using a flexible templating syntax.

§Features

  • Compile-time CSV processing - CSV files are read and processed during compilation
  • Template-based code generation - Use a simple template syntax to generate any Rust code
  • Field transformations - Convert CSV data to valid Rust identifiers, constants, types, and literals
  • Filtering support - Include/exclude rows based on conditions
  • Pivoting - Transform columns into key-value pairs for more flexible data structures
  • Type-safe literals - Generate properly typed numeric literals (42_f64, 10_u32, etc.)

§Getting Started

See the csv_template! macro documentation for detailed usage instructions, syntax reference, and examples.

§Use Cases

  • Configuration from CSV - Generate constants and enums from configuration data
  • Test data - Create test fixtures from CSV files
  • Code tables - Transform lookup tables into efficient match statements
  • Translations - Create internationalization constants from CSV files

§Additional Resources

§Status

This crate is in development and was built with AI assistance (Claude Code). The API may see changes in future versions. Contributions and code review are especially welcome!

Macros§

csv_template
Generates Rust code from CSV data using a templating syntax.