| Chih-Hung Hsieh | 92ff605 | 2020-06-10 20:18:39 -0700 | [diff] [blame] | 1 | use code_writer::CodeWriter; |
| 2 | use Customize; | ||||
| 3 | |||||
| 4 | /// Write serde attr according to specified codegen option. | ||||
| 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 | } | ||||