Struct CargoCallbacks

pub struct CargoCallbacks { /* private fields */ }

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, 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.

Trait Implementations

impl Debug for CargoCallbacks

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

impl Default for CargoCallbacks

fn default() -> Self

impl ParseCallbacks for CargoCallbacks

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

Auto Trait Implementations

impl Freeze for CargoCallbacks

impl RefUnwindSafe for CargoCallbacks

impl Send for CargoCallbacks

impl Sync for CargoCallbacks

impl Unpin for CargoCallbacks

impl UnsafeUnpin for CargoCallbacks

impl UnwindSafe for CargoCallbacks

Blanket Implementations

impl<T> Any for CargoCallbacks where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for CargoCallbacks where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for CargoCallbacks where T: ?Sized,

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

impl<T> From<T> for CargoCallbacks

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> IntoEither for CargoCallbacks

impl<T, U> Into<U> for CargoCallbacks where U: From<T>,

fn into(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<U> for CargoCallbacks where U: Into<T>,

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

impl<T, U> TryInto<U> for CargoCallbacks where U: TryFrom<T>,

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