summaryrefslogtreecommitdiff
path: root/src/callbacks.rs
diff options
context:
space:
mode:
authorEric Seppanen <eds@reric.net>2021-06-02 18:17:15 -0700
committerEmilio Cobos Álvarez <emilio@crisal.io>2021-07-16 21:23:05 +0200
commitb6109c00fcb13a27e06387ce2ef417a54c24cf3f (patch)
tree3a93f160080ad10e7b009b6b62a9495180279686 /src/callbacks.rs
parent67538b64ea1b90a0d01e4f6ebd45713ec03c9222 (diff)
add custom derives callback
This callback allows us to specify arbitrary derive attributes for each named struct. This is useful for adding things that can't easily be implemented separately, such as `serde::Deserialize` or `zerocopy::FromBytes`.
Diffstat (limited to 'src/callbacks.rs')
-rw-r--r--src/callbacks.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/callbacks.rs b/src/callbacks.rs
index e288af43..9b345449 100644
--- a/src/callbacks.rs
+++ b/src/callbacks.rs
@@ -95,4 +95,12 @@ pub trait ParseCallbacks: fmt::Debug + UnwindSafe {
) -> Option<ImplementsTrait> {
None
}
+
+ /// Provide a list of custom derive attributes.
+ ///
+ /// If no additional attributes are wanted, this function should return an
+ /// empty `Vec`.
+ fn add_derives(&self, _name: &str) -> Vec<String> {
+ vec![]
+ }
}