TypeChooser has been renamed to ParseCallbacks

This commit is contained in:
gwenn 2017-04-27 18:42:10 +02:00
parent 30bba4618b
commit e8bc9fcc21

View File

@ -139,7 +139,7 @@ mod build {
mod bindings { mod bindings {
extern crate bindgen; extern crate bindgen;
use self::bindgen::chooser::{TypeChooser, IntKind}; use self::bindgen::callbacks::{ParseCallbacks, IntKind};
use super::HeaderLocation; use super::HeaderLocation;
use std::env; use std::env;
@ -150,7 +150,7 @@ mod build {
#[derive(Debug)] #[derive(Debug)]
struct SqliteTypeChooser; struct SqliteTypeChooser;
impl TypeChooser for SqliteTypeChooser { impl ParseCallbacks for SqliteTypeChooser {
fn int_macro(&self, _name: &str, value: i64) -> Option<IntKind> { fn int_macro(&self, _name: &str, value: i64) -> Option<IntKind> {
if value >= i32::min_value() as i64 && value <= i32::max_value() as i64 { if value >= i32::min_value() as i64 && value <= i32::max_value() as i64 {
Some(IntKind::I32) Some(IntKind::I32)
@ -166,7 +166,7 @@ mod build {
let mut output = Vec::new(); let mut output = Vec::new();
bindgen::builder() bindgen::builder()
.header(header.clone()) .header(header.clone())
.type_chooser(Box::new(SqliteTypeChooser)) .parse_callbacks(Box::new(SqliteTypeChooser))
.generate() .generate()
.expect(&format!("could not run bindgen on header {}", header)) .expect(&format!("could not run bindgen on header {}", header))
.write(Box::new(&mut output)) .write(Box::new(&mut output))