mirror of
https://github.com/servo/servo.git
synced 2025-08-01 03:30:33 +01:00
style: Add a special list for cbindgen types to avoid generating redundant rust types.
We will blacklist this type and add a module raw line to map the gecko type to its rust type (as an alias). Differential Revision: https://phabricator.services.mozilla.com/D10303
This commit is contained in:
parent
8bc8a0bfa0
commit
b00bbb3be7
1 changed files with 6 additions and 0 deletions
|
@ -392,6 +392,12 @@ mod bindings {
|
|||
.handle_str_items("whitelist-vars", |b, item| b.whitelist_var(item))
|
||||
.handle_str_items("whitelist-types", |b, item| b.whitelist_type(item))
|
||||
.handle_str_items("opaque-types", |b, item| b.opaque_type(item))
|
||||
.handle_table_items("cbindgen-types", |b, item| {
|
||||
let gecko = item["gecko"].as_str().unwrap();
|
||||
let servo = item["servo"].as_str().unwrap();
|
||||
let line = format!("pub use {} as {};", servo, gecko.rsplit("::").next().unwrap());
|
||||
b.blacklist_type(gecko).module_raw_line("root::mozilla", line)
|
||||
})
|
||||
.handle_table_items("mapped-generic-types", |builder, item| {
|
||||
let generic = item["generic"].as_bool().unwrap();
|
||||
let gecko = item["gecko"].as_str().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue