Rust-bindgen: remove_prefix missing

Created on 24 Jan 2017  路  13Comments  路  Source: rust-lang/rust-bindgen

I already mentioned this in #21. I was using remove_prefix in bindgen 0.19. This means I can't upgrade to 0.20 without introducing an API change in my -sys crate.

A-parity-old-bindgen enhancement help wanted

All 13 comments

This seems like a really hacky thing to do. I think there are better ways to do this, mainly re-exporting structs with a different name.

That may be some churn, though, and it's definitely something we could automate...

@emilio are you still planning on working on this? It's one of the last pieces preventing me from upgrading from 0.19.

I... Don't really know how this would work for C++, but it shouldn't be hard to do for C.

I don't have a particular incentive to work on this though I could give it a shot when I have some more free time.

In any case, the place to apply the option would be here:

https://github.com/rust-lang-nursery/rust-bindgen/blob/5de943ca7bf6c155f7bae1d91f1e3b1d91e8d901/src/ir/item.rs#L876

That already has access to BindgenContext, and thus the options, so should be trivial to make it work if somebody gets to it sooner.

What do you think about adding another function on ParseCallbacks that allows people to completely change the name of any item as they see fit?

Hmm, I'd rather not expose the Item type in the public API unless totally necessary, but if you mean "get a name, give a name", that'd be fine for me I suppose.

It may be somewhat tricky to make it work correctly though...

I opened a pull request that adds an item_name callback. It is sufficient for our needs in rust-mbedtls. Providing the item kind could be useful but ItemKind is not exposed at the moment.

Fixed in #1438, thanks @ekse!

Hi emilio, would it be possible to make a new release on crates.io?

Sure, done :)

Thanks emilio, is it expected I don't see it on crates.io?

Blergh, no, was not expected. I recently switched distro version, and I didn't keep the cargo api token around, so the publishing failed. Should be in crates.io now.

Thanks! The crate update is available as expected.

Was this page helpful?
0 / 5 - 0 ratings