Struct CargoCallbacks

struct CargoCallbacks { ... }

A ParseCallbacks implementation that will act on file includes by echoing a rerun-if-changed line and on env variable usage by echoing a rerun-if-env-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::new()))
    .generate();

Implementations

impl CargoCallbacks

fn new() -> Self

Create a new CargoCallbacks value.

fn rerun_on_header_files(self: Self, doit: bool) -> Self

Whether Cargo should re-run the build script if any of the input header files has changed.

This option is enabled by default unless the deprecated [const@CargoCallbacks] constructor is used.

impl Debug for CargoCallbacks

fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result

impl Default for CargoCallbacks

fn default() -> Self

impl Freeze for CargoCallbacks

impl ParseCallbacks for CargoCallbacks

fn header_file(self: &Self, filename: &str)
fn include_file(self: &Self, filename: &str)
fn read_env_var(self: &Self, key: &str)

impl RefUnwindSafe for CargoCallbacks

impl Send for CargoCallbacks

impl Sync for CargoCallbacks

impl Unpin for CargoCallbacks

impl UnwindSafe for CargoCallbacks

impl<T> Any for CargoCallbacks

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for CargoCallbacks

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for CargoCallbacks

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for CargoCallbacks

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for CargoCallbacks

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for CargoCallbacks

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for CargoCallbacks

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>