Skip to content

Add export.include_all for public types - #1182

Open
youknowone wants to merge 2 commits into
mozilla:mainfrom
youknowone:export-all
Open

Add export.include_all for public types#1182
youknowone wants to merge 2 commits into
mozilla:mainfrom
youknowone:export-all

Conversation

@youknowone

Copy link
Copy Markdown
Contributor

resolve #605

`export.include_all` appended the collected public type names to
`config.export.include` after parsing. The roots now travel through a
`public_types` field on `Parse` and `Library` instead, and
`Library::generate` seeds them next to functions, globals and constants.
`Library::add_root` holds the traversal shared with `export.include`.

Recording a public type now requires
`ParseConfig::should_generate_top_level_item`, the gate that functions,
statics and constants already pass, so only the binding crate and
`parse.extra_bindings` contribute. Types of other parsed crates are
still emitted when an exported item depends on them.

Assisted-by: Claude
Comment thread src/bindgen/parser.rs
Comment on lines +495 to +496
fn record_public_type(&mut self, record: bool, vis: &syn::Visibility, path: &Path) {
if record && matches!(vis, syn::Visibility::Public(_)) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feed awkward that record_public_type and its callers have a parameter like record: bool, but didn't find good way not to do yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to export all the types that are public and repr(C)

1 participant