Skip to content

rename TypeKind::Named to TypeKind::TypeParam #915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ mod codegen {
println!("cargo:rerun-if-changed=src/codegen/helpers.rs");
println!("cargo:rerun-if-changed=src/codegen/struct_layout.rs");

let mut dst =
File::create(Path::new(&out_dir).join("host-target.txt")).unwrap();
dst.write_all(env::var("TARGET").unwrap().as_bytes()).unwrap();
let mut dst = File::create(Path::new(&out_dir).join("host-target.txt"))
.unwrap();
dst.write_all(env::var("TARGET").unwrap().as_bytes())
.unwrap();
}
}

Expand All @@ -32,9 +33,11 @@ mod testgen {

pub fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let mut dst = File::create(Path::new(&out_dir).join("tests.rs")).unwrap();
let mut dst = File::create(Path::new(&out_dir).join("tests.rs"))
.unwrap();

let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let manifest_dir =
PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let headers_dir = manifest_dir.join("tests").join("headers");

let headers = match fs::read_dir(headers_dir) {
Expand All @@ -51,12 +54,19 @@ mod testgen {
for entry in entries {
match entry.path().extension().and_then(OsStr::to_str) {
Some("h") | Some("hpp") => {
let func = entry.file_name().to_str().unwrap()
let func = entry
.file_name()
.to_str()
.unwrap()
.replace(|c| !char::is_alphanumeric(c), "_")
.replace("__", "_")
.to_lowercase();
writeln!(dst, "test_header!(header_{}, {:?});",
func, entry.path()).unwrap();
writeln!(
dst,
"test_header!(header_{}, {:?});",
func,
entry.path()
).unwrap();
}
_ => {}
}
Expand Down
12 changes: 6 additions & 6 deletions src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::panic::UnwindSafe;
/// A trait to allow configuring different kinds of types in different
/// situations.
pub trait ParseCallbacks: fmt::Debug + UnwindSafe {

/// This function will be run on every macro that is identified
fn parsed_macro(&self, _name: &str) {}

Expand All @@ -21,11 +20,12 @@ pub trait ParseCallbacks: fmt::Debug + UnwindSafe {
/// This function should return whether, given the a given enum variant
/// name, and value, returns whether this enum variant will forcibly be a
/// constant.
fn enum_variant_behavior(&self,
_enum_name: Option<&str>,
_variant_name: &str,
_variant_value: EnumVariantValue)
-> Option<EnumVariantCustomBehavior> {
fn enum_variant_behavior(
&self,
_enum_name: Option<&str>,
_variant_name: &str,
_variant_value: EnumVariantValue,
) -> Option<EnumVariantCustomBehavior> {
None
}
}
Loading