Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Generate `BindgenOptions` and the `Builder` methods using macros This is done so the definition, default value and `Builder` methods for each field of `BindgenOptions` are kept in the same region of code. Before this change, adding (or modifying) a new option for `bindgen` required: - Updating the fields of the `BindgenOptions` type. - Updating the `Default` implementation for `BindgenOptions`. - Updating one or several `Builder` methods with proper documentation explaining the default value of the option. - Updating the `Builder::command_line_flags` method. Each one of these steps was done in a different place inside `bindgen/lib.rs`. With this change, all these 4 steps are done in the same place. This should make less likely to have bugs. Clearly using macros implies properly documenting how to use such macros and makes adding new options a bit harder because most (all?) editors are not able to format code and suggest completions inside macros. This change also moves all the code related to setting `BindgenOptions` to the new `bindgen/options.rs` file. * Factor out the "Regex are supported" docs. All the options that support regular expressions had the following sentence in their documentation: > Regular expressions are supported This comment was factored out to the macro that documents options based on `RegexSet`s. * Rename `fn_with_regex_arg` to `regex_option` * Allow optional commas in the `options` macro. This is done to avoid hard to detect macro parsing issues due to missing commas. * Fix typo * Add the `AsArg` trait. This trait eases the conversion of `BindgenOptions` fields into CLI args. This commit also changes the `options` macro so the flag can be passed to `as_args` instead of a closure. * Document the `option` macro * Document the `options` module * Rewrite some documentation * Run rustfmt * Avoid examples with `bool` parameters * More documentation changes * Reorganize the `options` module * Run rustfmt
- Loading branch information