summaryrefslogtreecommitdiff
path: root/bindgen/callbacks.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bindgen/callbacks.rs')
-rw-r--r--bindgen/callbacks.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/bindgen/callbacks.rs b/bindgen/callbacks.rs
index cba406cb..dc20e258 100644
--- a/bindgen/callbacks.rs
+++ b/bindgen/callbacks.rs
@@ -25,6 +25,12 @@ impl Default for MacroParsingBehavior {
/// A trait to allow configuring different kinds of types in different
/// situations.
pub trait ParseCallbacks: fmt::Debug {
+ #[cfg(feature = "cli")]
+ #[doc(hidden)]
+ fn cli_args(&self) -> Vec<String> {
+ vec![]
+ }
+
/// This function will be run on every macro that is identified.
fn will_parse_macro(&self, _name: &str) -> MacroParsingBehavior {
MacroParsingBehavior::Default
@@ -120,10 +126,24 @@ pub trait ParseCallbacks: fmt::Debug {
/// Relevant information about a type to which new derive attributes will be added using
/// [`ParseCallbacks::add_derives`].
+#[derive(Debug)]
#[non_exhaustive]
pub struct DeriveInfo<'a> {
/// The name of the type.
pub name: &'a str,
+ /// The kind of the type.
+ pub kind: TypeKind,
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+/// The kind of the current type.
+pub enum TypeKind {
+ /// The type is a Rust `struct`.
+ Struct,
+ /// The type is a Rust `enum`.
+ Enum,
+ /// The type is a Rust `union`.
+ Union,
}
/// An struct providing information about the item being passed to `ParseCallbacks::generated_name_override`.