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
17#[cfg(feature = "unstable_ir")]
18pub mod bindgen;
19#[cfg(not(feature = "unstable_ir"))]
20mod bindgen;
21
22pub use crate::bindgen::*;
23
24use std::path::Path;
25
26pub fn generate<P: AsRef<Path>>(crate_dir: P) -> Result<Bindings, Error> {
29 let config = Config::from_root_or_default(crate_dir.as_ref());
30
31 generate_with_config(crate_dir, config)
32}
33
34pub fn generate_with_config<P: AsRef<Path>>(
37 crate_dir: P,
38 config: Config,
39) -> Result<Bindings, Error> {
40 Builder::new()
41 .with_config(config)
42 .with_crate(crate_dir)
43 .generate()
44}