1 use code_writer::CodeWriter;
2 use Customize;
3 
4 /// Write serde attr according to specified codegen option.
write_serde_attr(w: &mut CodeWriter, customize: &Customize, attr: &str)5 pub fn write_serde_attr(w: &mut CodeWriter, customize: &Customize, attr: &str) {
6     if customize.serde_derive.unwrap_or(false) {
7         w.write_line(&format!("#[cfg_attr(feature = \"with-serde\", {})]", attr));
8     }
9 }
10