summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 69dde2c5..b703a106 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -3014,6 +3014,16 @@ impl CodeGenerator for Enum {
derives.push(derive);
}
}
+
+ // The custom derives callback may return a list of derive attributes;
+ // add them to the end of the list.
+ let custom_derives;
+ if let Some(cb) = &ctx.options().parse_callbacks {
+ custom_derives = cb.add_derives(&name);
+ // In most cases this will be a no-op, since custom_derives will be empty.
+ derives.extend(custom_derives.iter().map(|s| s.as_str()));
+ };
+
attrs.push(attributes::derives(&derives));
}