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:
Boris Chiou 2018-10-31 06:19:52 +00:00 committed by Emilio Cobos Álvarez
parent 8bc8a0bfa0
commit b00bbb3be7
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -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();