Struct bindgen::CargoCallbacks
source · pub struct CargoCallbacks;
Expand description
A ParseCallbacks implementation that will act on file includes by echoing a rerun-if-changed line
When running inside a build.rs
script, this can be used to make cargo invalidate the
generated bindings whenever any of the files included from the header change:
use bindgen::builder;
let bindings = builder()
.header("path/to/input/header")
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate();
Trait Implementations
sourceimpl Debug for CargoCallbacks
impl Debug for CargoCallbacks
sourceimpl ParseCallbacks for CargoCallbacks
impl ParseCallbacks for CargoCallbacks
sourcefn include_file(&self, filename: &str)
fn include_file(&self, filename: &str)
This will be called on every file inclusion, with the full path of the included file.
sourcefn will_parse_macro(&self, _name: &str) -> MacroParsingBehavior
fn will_parse_macro(&self, _name: &str) -> MacroParsingBehavior
This function will be run on every macro that is identified.
sourcefn generated_name_override(&self, _function_name: &str) -> Option<String>
fn generated_name_override(&self, _function_name: &str) -> Option<String>
This function will run for every function. The returned value determines the name visible
in the bindings. Read more
sourcefn int_macro(&self, _name: &str, _value: i64) -> Option<IntKind>
fn int_macro(&self, _name: &str, _value: i64) -> Option<IntKind>
The integer kind an integer macro should have, given a name and the
value of that macro, or
None
if you want the default to be chosen. Read moresourcefn str_macro(&self, _name: &str, _value: &[u8])
fn str_macro(&self, _name: &str, _value: &[u8])
This will be run on every string macro. The callback cannot influence the further
treatment of the macro, but may use the value to generate additional code or configuration. Read more
sourcefn func_macro(&self, _name: &str, _value: &[&[u8]])
fn func_macro(&self, _name: &str, _value: &[&[u8]])
This will be run on every function-like macro. The callback cannot
influence the further treatment of the macro, but may use the value to
generate additional code or configuration. Read more
sourcefn enum_variant_behavior(
&self,
_enum_name: Option<&str>,
_original_variant_name: &str,
_variant_value: EnumVariantValue
) -> Option<EnumVariantCustomBehavior>
fn enum_variant_behavior(
&self,
_enum_name: Option<&str>,
_original_variant_name: &str,
_variant_value: EnumVariantValue
) -> Option<EnumVariantCustomBehavior>
This function should return whether, given an enum variant
name, and value, this enum variant will forcibly be a constant. Read more
sourcefn enum_variant_name(
&self,
_enum_name: Option<&str>,
_original_variant_name: &str,
_variant_value: EnumVariantValue
) -> Option<String>
fn enum_variant_name(
&self,
_enum_name: Option<&str>,
_original_variant_name: &str,
_variant_value: EnumVariantValue
) -> Option<String>
Allows to rename an enum variant, replacing
_original_variant_name
.sourcefn item_name(&self, _original_item_name: &str) -> Option<String>
fn item_name(&self, _original_item_name: &str) -> Option<String>
Allows to rename an item, replacing
_original_item_name
.sourcefn blocklisted_type_implements_trait(
&self,
_name: &str,
_derive_trait: DeriveTrait
) -> Option<ImplementsTrait>
fn blocklisted_type_implements_trait(
&self,
_name: &str,
_derive_trait: DeriveTrait
) -> Option<ImplementsTrait>
This will be called to determine whether a particular blocklisted type
implements a trait or not. This will be used to implement traits on
other types containing the blocklisted type. Read more
sourcefn add_derives(&self, _info: &DeriveInfo<'_>) -> Vec<String> ⓘ
fn add_derives(&self, _info: &DeriveInfo<'_>) -> Vec<String> ⓘ
Provide a list of custom derive attributes. Read more
sourcefn process_comment(&self, _comment: &str) -> Option<String>
fn process_comment(&self, _comment: &str) -> Option<String>
Process a source code comment.
Auto Trait Implementations
impl RefUnwindSafe for CargoCallbacks
impl Send for CargoCallbacks
impl Sync for CargoCallbacks
impl Unpin for CargoCallbacks
impl UnwindSafe for CargoCallbacks
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more