We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
csv
1.1.6
Serialize the header prefixed with a comment character (eg. '#')
use std::fs::File; use std::io::Write; use serde::Serialize; #[derive(Debug, Clone, Serialize)] pub struct Partition { name: String, #[serde(rename="type")] partition_type: u32, subtype: u32, offset: u32, size: u32, flags: u32, } fn main() { let partitions = vec![ Partition { name: "test".to_owned(), partition_type: 1, subtype: 1, offset: 1, size: 1, flags: 1, }, Partition { name: "test2".to_owned(), partition_type: 1, subtype: 1, offset: 1, size: 1, flags: 1, }, ]; let mut wrt = csv::Writer::from_writer(std::io::stdout()); partitions.iter().for_each(|partition| wrt.serialize(partition).unwrap()); wrt.flush().unwrap(); }
name,type,subtype,offset,size,flags
#name,type,subtype,offset,size,flags
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What version of the
csv
crate are you using?1.1.6
Briefly describe the question, bug or feature request.
Serialize the header prefixed with a comment character (eg. '#')
Include a complete program demonstrating a problem.
What is the observed behavior of the code above?
name,type,subtype,offset,size,flags
What is the expected or desired behavior of the code above?
#name,type,subtype,offset,size,flags
The text was updated successfully, but these errors were encountered: