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() {
let config = Config::default();
Library::load("../build-script", &config)
.build().unwrap()
.generate().unwrap()
.write_to_file("bindings.h");
}
```
......
......@@ -6,6 +6,6 @@ fn main() {
let config = Config::default();
Library::load("../build-script", &config)
.build().unwrap()
.generate().unwrap()
.write_to_file("bindings.h");
}
......@@ -13,7 +13,7 @@ use bindgen::rust_lib;
use bindgen::syn_helpers::*;
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)]
pub enum Repr {
......@@ -57,7 +57,7 @@ impl PathValue {
/// A library collects all of the information needed to generate
/// 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.
#[derive(Debug, Clone)]
pub struct Library<'a> {
......@@ -260,8 +260,8 @@ impl<'a> Library<'a> {
}
}
pub fn build(self) -> BuildResult<BuiltLibrary<'a>> {
let mut result = BuiltLibrary::blank(self.config);
pub fn generate(self) -> GenerateResult<GeneratedLibrary<'a>> {
let mut result = GeneratedLibrary::blank(self.config);
// Gather only the items that we need for this
// `extern "c"` interface
......@@ -271,7 +271,7 @@ impl<'a> Library<'a> {
}
// Copy the binding items in dependencies order
// into the BuiltLibrary, specializing any type
// into the GeneratedLibrary, specializing any type
// aliases we encounter
for dep in deps {
match &dep {
......@@ -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)]
pub struct BuiltLibrary<'a> {
pub struct GeneratedLibrary<'a> {
config: &'a Config,
items: Vec<PathValue>,
functions: Vec<Function>,
}
impl<'a> BuiltLibrary<'a> {
fn blank(config: &'a Config) -> BuiltLibrary<'a> {
BuiltLibrary {
impl<'a> GeneratedLibrary<'a> {
fn blank(config: &'a Config) -> GeneratedLibrary<'a> {
GeneratedLibrary {
config: config,
items: Vec::new(),
functions: Vec::new(),
......
......@@ -6,4 +6,4 @@ mod rust_lib;
mod syn_helpers;
pub use self::config::*;
pub use self::library::{Library, BuiltLibrary};
pub use self::library::Library;
......@@ -47,11 +47,11 @@ fn main() {
None => Config::default(),
};
let built = match Library::load(input, &config).build() {
let built = match Library::load(input, &config).generate() {
Ok(x) => x,
Err(msg) => {
error!("{}", msg);
error!("could not build bindings for {}", input);
error!("could not generate bindings for {}", input);
return;
},
};
......
Markdown is supported
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