This library provides a lightweight way to export data to the CSV format via trait implementation.
Example
[]
= "1.0"
Result
Data Name,Amount,Date,
Test Data,10,6/3/2025,
This library provides a lightweight way to export data to the CSV format via trait implementation.
[dependencies]
to_csv = "1.0"
impl CSV for TypeA {
fn headers(&self) -> String {
format!("{},{},{}", "Data Name", "Amount", "Date",)
}
fn row(&self) -> String {
format!(
"{},{},{}",
self.name,
self.value,
self.date,
)
}
}
fn main() {
let _ = to_csv_file("csv_file.csv", &entries);
}
Data Name,Amount,Date,
Test Data,10,6/3/2025,