Commit b86d9a9a authored by Ryan Hunt's avatar Ryan Hunt
Browse files

Rename Library::build to Library::generate

It's called bindings generation not bindings building.
parent a62e8086
...@@ -31,7 +31,7 @@ fn main() { ...@@ -31,7 +31,7 @@ fn main() {
let config = Config::default(); let config = Config::default();
Library::load("../build-script", &config) Library::load("../build-script", &config)
.build().unwrap() .generate().unwrap()
.write_to_file("bindings.h"); .write_to_file("bindings.h");
} }
``` ```
......
...@@ -6,6 +6,6 @@ fn main() { ...@@ -6,6 +6,6 @@ fn main() {
let config = Config::default(); let config = Config::default();
Library::load("../build-script", &config) Library::load("../build-script", &config)
.build().unwrap() .generate().unwrap()
.write_to_file("bindings.h"); .write_to_file("bindings.h");
} }
...@@ -13,7 +13,7 @@ use bindgen::rust_lib; ...@@ -13,7 +13,7 @@ use bindgen::rust_lib;
use bindgen::syn_helpers::*; use bindgen::syn_helpers::*;
pub type ConvertResult<T> = Result<T, String>; pub type ConvertResult<T> = Result<T, String>;
pub type BuildResult<T> = Result<T, String>; pub type GenerateResult<T> = Result<T, String>;
#[derive(Debug, Copy, Clone, PartialEq)] #[derive(Debug, Copy, Clone, PartialEq)]
pub enum Repr { pub enum Repr {
...@@ -57,7 +57,7 @@ impl PathValue { ...@@ -57,7 +57,7 @@ impl PathValue {
/// A library collects all of the information needed to generate /// A library collects all of the information needed to generate
/// bindings for a specified rust library. It is turned into a /// bindings for a specified rust library. It is turned into a
/// BuiltLibrary, and in the process filters out unneeded information /// GeneratedLibrary, and in the process filters out unneeded information
/// and in the future will do validation. /// and in the future will do validation.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Library<'a> { pub struct Library<'a> {
...@@ -260,8 +260,8 @@ impl<'a> Library<'a> { ...@@ -260,8 +260,8 @@ impl<'a> Library<'a> {
} }
} }
pub fn build(self) -> BuildResult<BuiltLibrary<'a>> { pub fn generate(self) -> GenerateResult<GeneratedLibrary<'a>> {
let mut result = BuiltLibrary::blank(self.config); let mut result = GeneratedLibrary::blank(self.config);
// Gather only the items that we need for this // Gather only the items that we need for this
// `extern "c"` interface // `extern "c"` interface
...@@ -271,7 +271,7 @@ impl<'a> Library<'a> { ...@@ -271,7 +271,7 @@ impl<'a> Library<'a> {
} }
// Copy the binding items in dependencies order // Copy the binding items in dependencies order
// into the BuiltLibrary, specializing any type // into the GeneratedLibrary, specializing any type
// aliases we encounter // aliases we encounter
for dep in deps { for dep in deps {
match &dep { match &dep {
...@@ -316,18 +316,18 @@ impl<'a> Library<'a> { ...@@ -316,18 +316,18 @@ impl<'a> Library<'a> {
} }
} }
/// A BuiltLibrary represents a completed bindings file ready to be printed. /// A GeneratedLibrary represents a completed bindings file ready to be printed.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct BuiltLibrary<'a> { pub struct GeneratedLibrary<'a> {
config: &'a Config, config: &'a Config,
items: Vec<PathValue>, items: Vec<PathValue>,
functions: Vec<Function>, functions: Vec<Function>,
} }
impl<'a> BuiltLibrary<'a> { impl<'a> GeneratedLibrary<'a> {
fn blank(config: &'a Config) -> BuiltLibrary<'a> { fn blank(config: &'a Config) -> GeneratedLibrary<'a> {
BuiltLibrary { GeneratedLibrary {
config: config, config: config,
items: Vec::new(), items: Vec::new(),
functions: Vec::new(), functions: Vec::new(),
......
...@@ -6,4 +6,4 @@ mod rust_lib; ...@@ -6,4 +6,4 @@ mod rust_lib;
mod syn_helpers; mod syn_helpers;
pub use self::config::*; pub use self::config::*;
pub use self::library::{Library, BuiltLibrary}; pub use self::library::Library;
...@@ -47,11 +47,11 @@ fn main() { ...@@ -47,11 +47,11 @@ fn main() {
None => Config::default(), None => Config::default(),
}; };
let built = match Library::load(input, &config).build() { let built = match Library::load(input, &config).generate() {
Ok(x) => x, Ok(x) => x,
Err(msg) => { Err(msg) => {
error!("{}", msg); error!("{}", msg);
error!("could not build bindings for {}", input); error!("could not generate bindings for {}", input);
return; return;
}, },
}; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment