mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Format remaining files
This commit is contained in:
parent
bf47f90da6
commit
cb07debcb6
252 changed files with 5944 additions and 3744 deletions
|
@ -284,7 +284,8 @@ mod bindings {
|
|||
let macro_name = captures.get(1).unwrap().as_str().to_string();
|
||||
let type_name = captures.get(2).unwrap().as_str().to_string();
|
||||
(macro_name, type_name)
|
||||
}).collect()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_borrowed_types() -> Vec<(bool, String)> {
|
||||
|
@ -419,7 +420,8 @@ mod bindings {
|
|||
servo,
|
||||
if generic { "<T>" } else { "" }
|
||||
))
|
||||
}).get_builder();
|
||||
})
|
||||
.get_builder();
|
||||
write_binding_file(builder, STRUCTS_FILE, &fixups);
|
||||
}
|
||||
|
||||
|
@ -467,7 +469,8 @@ mod bindings {
|
|||
filter: env::var("STYLO_BUILD_FILTER")
|
||||
.ok()
|
||||
.unwrap_or_else(|| "bindgen".to_owned()),
|
||||
})).expect("Failed to set logger.");
|
||||
}))
|
||||
.expect("Failed to set logger.");
|
||||
|
||||
true
|
||||
} else {
|
||||
|
@ -486,7 +489,8 @@ mod bindings {
|
|||
.handle_common(&mut fixups)
|
||||
.handle_str_items("whitelist-functions", |b, item| b.whitelist_function(item))
|
||||
.handle_str_items("structs-types", |mut builder, ty| {
|
||||
builder = builder.blacklist_type(ty)
|
||||
builder = builder
|
||||
.blacklist_type(ty)
|
||||
.raw_line(format!("use gecko_bindings::structs::{};", ty));
|
||||
structs_types.insert(ty);
|
||||
// TODO this is hacky, figure out a better way to do it without
|
||||
|
@ -504,10 +508,14 @@ mod bindings {
|
|||
.handle_table_items("array-types", |builder, item| {
|
||||
let cpp_type = item["cpp-type"].as_str().unwrap();
|
||||
let rust_type = item["rust-type"].as_str().unwrap();
|
||||
builder
|
||||
.raw_line(format!(concat!("pub type nsTArrayBorrowed_{}<'a> = ",
|
||||
"&'a mut ::gecko_bindings::structs::nsTArray<{}>;"),
|
||||
cpp_type, rust_type))
|
||||
builder.raw_line(format!(
|
||||
concat!(
|
||||
"pub type nsTArrayBorrowed_{}<'a> = ",
|
||||
"&'a mut ::gecko_bindings::structs::nsTArray<{}>;"
|
||||
),
|
||||
cpp_type,
|
||||
rust_type
|
||||
))
|
||||
})
|
||||
.handle_str_items("servo-immutable-borrow-types", |b, ty| b.borrowed_type(ty))
|
||||
// Right now the only immutable borrow types are ones which we import
|
||||
|
@ -529,7 +537,8 @@ mod bindings {
|
|||
.raw_line(format!(
|
||||
"pub type {0}Strong = ::gecko_bindings::sugar::ownership::Strong<{0}>;",
|
||||
ty
|
||||
)).borrowed_type(ty)
|
||||
))
|
||||
.borrowed_type(ty)
|
||||
.zero_size_type(ty, &structs_types);
|
||||
}
|
||||
for ty in get_boxed_types().iter() {
|
||||
|
@ -538,14 +547,16 @@ mod bindings {
|
|||
.raw_line(format!(
|
||||
"pub type {0}Owned = ::gecko_bindings::sugar::ownership::Owned<{0}>;",
|
||||
ty
|
||||
)).blacklist_type(format!("{}OwnedOrNull", ty))
|
||||
))
|
||||
.blacklist_type(format!("{}OwnedOrNull", ty))
|
||||
.raw_line(format!(
|
||||
concat!(
|
||||
"pub type {0}OwnedOrNull = ",
|
||||
"::gecko_bindings::sugar::ownership::OwnedOrNull<{0}>;"
|
||||
),
|
||||
ty
|
||||
)).mutable_borrowed_type(ty)
|
||||
))
|
||||
.mutable_borrowed_type(ty)
|
||||
.zero_size_type(ty, &structs_types);
|
||||
}
|
||||
write_binding_file(builder, BINDINGS_FILE, &fixups);
|
||||
|
@ -622,7 +633,8 @@ mod bindings {
|
|||
println!("cargo:rerun-if-changed={}", dir.display());
|
||||
copy_dir(&dir, &*OUTDIR_PATH, |path| {
|
||||
println!("cargo:rerun-if-changed={}", path.display());
|
||||
}).expect("Fail to copy generated files to out dir");
|
||||
})
|
||||
.expect("Fail to copy generated files to out dir");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue