1#[macro_use]
6extern crate log;
7extern crate proc_macro2;
8#[macro_use]
9extern crate serde;
10extern crate serde_json;
11#[macro_use]
12extern crate quote;
13#[macro_use]
14extern crate syn;
15extern crate toml;
16
17mod bindgen;
18
19pub use crate::bindgen::*;
20
21use std::path::Path;
22
23pub fn generate<P: AsRef<Path>>(crate_dir: P) -> Result<Bindings, Error> {
26 let config = Config::from_root_or_default(crate_dir.as_ref());
27
28 generate_with_config(crate_dir, config)
29}
30
31pub fn generate_with_config<P: AsRef<Path>>(
34 crate_dir: P,
35 config: Config,
36) -> Result<Bindings, Error> {
37 Builder::new()
38 .with_config(config)
39 .with_crate(crate_dir)
40 .generate()
41}