fn generate_and_save_bindings_to_file(wstp_h: &PathBuf, out_path: &PathBuf) {
    assert!(wstp_h.file_name().unwrap() == "wstp.h");

    let bindings = bindgen::Builder::default()
        .header(wstp_h.display().to_string())
        .generate_comments(true)
        .rustfmt_bindings(true)
        // Force the WSE* error macro definitions to be interpreted as signed constants.
        // WSTP uses `int` as it's error type, so this is necessary to avoid having to
        // scatter `as i32` everywhere.
        .default_macro_constant_type(bindgen::MacroTypeVariation::Signed)
        .generate()
        .expect("unable to generate Rust bindings to WSTP using bindgen");

    std::fs::create_dir_all(out_path.parent().unwrap())
        .expect("failed to create parent directories for generating bindings file");

    bindings
        .write_to_file(&out_path)
        .expect("failed to write Rust bindings with IO error");
}
/// Note: The definition of this function is copied from
///       scripts/generate-versioned-bindings.rs. Changes to this copy of the function
///       should also be made to the other copy.
The definition of this function is copied from
scripts/generate-versioned-bindings.rs. Changes to this copy of the function
should also be made to the other copy.
The definition of this function is copied from scripts / generate - versioned - bindings . rs . Changes to this copy of the function should also be made to the other copy .
fn generate_and_save_bindings_to_file(wstp_h: &PathBuf, out_path: &PathBuf) {
    assert!(wstp_h.file_name().unwrap() == "wstp.h");
    let bindings = bindgen::Builder::default()
        .header(wstp_h.display().to_string())
        .generate_comments(true)
        .rustfmt_bindings(true)
        // Force the WSE* error macro definitions to be interpreted as signed constants.
        // WSTP uses `int` as it's error type, so this is necessary to avoid having to
        // scatter `as i32` everywhere.
        .default_macro_constant_type(bindgen::MacroTypeVariation::Signed)
        .generate()
        .expect("unable to generate Rust bindings to WSTP using bindgen");
    std::fs::create_dir_all(out_path.parent().unwrap())
        .expect("failed to create parent directories for generating bindings file");
    bindings
        .write_to_file(&out_path)
        .expect("failed to write Rust bindings with IO error");
}
fn generate_and_save_bindings_to_file ( wstp_h : & PathBuf , out_path : & PathBuf ) { assert ! ( wstp_h file_name ( ) unwrap ( ) " " ) ; let bindings = bindgen :: Builder :: default ( ) . header ( wstp_h . display ( ) . to_string ( ) ) . generate_comments ( true ) . rustfmt_bindings ( true ) // Force the WSE* error macro definitions to be interpreted as signed constants. // WSTP uses `int` as it's error type, so this is necessary to avoid having to // scatter `as i32` everywhere. . default_macro_constant_type ( bindgen :: MacroTypeVariation :: Signed ) . generate ( ) . expect ( " " ) ; std :: fs :: create_dir_all ( out_path . parent ( ) . unwrap ( ) ) . expect ( " " ) ; bindings . write_to_file ( & out_path ) . expect ( " " ) ; }
Note: The definition of this function is copied from
scripts/generate-versioned-bindings.rs.
Note : The definition of this function is copied from scripts / generate - versioned - bindings . rs .
wstp_h
&PathBuf
out_path
&PathBuf