Skip to content

Commit

Permalink
Regenerate documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hlopko committed Nov 8, 2024
1 parent ad67875 commit 5379a11
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
8 changes: 4 additions & 4 deletions bindgen/private/bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,15 @@ rust_bindgen = rule(
allow_single_file = True,
mandatory = True,
),
"wrap_static_fns": attr.bool(
doc = "Whether to create a separate .c file for static fns. Requires nightly toolchain, and a header that actually needs this feature (otherwise bindgen won't generate the file and Bazel complains).",
default = False,
),
"merge_cc_lib_objects_into_rlib": attr.bool(
doc = ("When True, objects from `cc_lib` will be copied into the `rlib` archive produced by " +
"the rust_library that depends on this `rust_bindgen` rule (using `BuildInfo` provider)"),
default = True,
),
"wrap_static_fns": attr.bool(
doc = "Whether to create a separate .c file for static fns. Requires nightly toolchain, and a header that actually needs this feature (otherwise bindgen won't generate the file and Bazel complains).",
default = False,
),
"_cc_toolchain": attr.label(
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
Expand Down
4 changes: 3 additions & 1 deletion docs/src/flatten.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ is available under the key `dsym_folder` in `OutputGroupInfo`.
## rust_bindgen

<pre>
rust_bindgen(<a href="#rust_bindgen-name">name</a>, <a href="#rust_bindgen-bindgen_flags">bindgen_flags</a>, <a href="#rust_bindgen-cc_lib">cc_lib</a>, <a href="#rust_bindgen-clang_flags">clang_flags</a>, <a href="#rust_bindgen-header">header</a>, <a href="#rust_bindgen-wrap_static_fns">wrap_static_fns</a>)
rust_bindgen(<a href="#rust_bindgen-name">name</a>, <a href="#rust_bindgen-bindgen_flags">bindgen_flags</a>, <a href="#rust_bindgen-cc_lib">cc_lib</a>, <a href="#rust_bindgen-clang_flags">clang_flags</a>, <a href="#rust_bindgen-header">header</a>, <a href="#rust_bindgen-merge_cc_lib_objects_into_rlib">merge_cc_lib_objects_into_rlib</a>,
<a href="#rust_bindgen-wrap_static_fns">wrap_static_fns</a>)
</pre>

Generates a rust source file from a cc_library and a header.
Expand All @@ -344,6 +345,7 @@ Generates a rust source file from a cc_library and a header.
| <a id="rust_bindgen-cc_lib"></a>cc_lib | The cc_library that contains the `.h` file. This is used to find the transitive includes. | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
| <a id="rust_bindgen-clang_flags"></a>clang_flags | Flags to pass directly to the clang executable. | List of strings | optional | `[]` |
| <a id="rust_bindgen-header"></a>header | The `.h` file to generate bindings for. | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
| <a id="rust_bindgen-merge_cc_lib_objects_into_rlib"></a>merge_cc_lib_objects_into_rlib | When True, objects from `cc_lib` will be copied into the `rlib` archive produced by the rust_library that depends on this `rust_bindgen` rule (using `BuildInfo` provider) | Boolean | optional | `True` |
| <a id="rust_bindgen-wrap_static_fns"></a>wrap_static_fns | Whether to create a separate .c file for static fns. Requires nightly toolchain, and a header that actually needs this feature (otherwise bindgen won't generate the file and Bazel complains). | Boolean | optional | `False` |


Expand Down
4 changes: 3 additions & 1 deletion docs/src/rust_bindgen.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ toolchains following the instructions for [rust_bindgen_toolchain](#rust_bindgen
## rust_bindgen

<pre>
rust_bindgen(<a href="#rust_bindgen-name">name</a>, <a href="#rust_bindgen-bindgen_flags">bindgen_flags</a>, <a href="#rust_bindgen-cc_lib">cc_lib</a>, <a href="#rust_bindgen-clang_flags">clang_flags</a>, <a href="#rust_bindgen-header">header</a>, <a href="#rust_bindgen-wrap_static_fns">wrap_static_fns</a>)
rust_bindgen(<a href="#rust_bindgen-name">name</a>, <a href="#rust_bindgen-bindgen_flags">bindgen_flags</a>, <a href="#rust_bindgen-cc_lib">cc_lib</a>, <a href="#rust_bindgen-clang_flags">clang_flags</a>, <a href="#rust_bindgen-header">header</a>, <a href="#rust_bindgen-merge_cc_lib_objects_into_rlib">merge_cc_lib_objects_into_rlib</a>,
<a href="#rust_bindgen-wrap_static_fns">wrap_static_fns</a>)
</pre>

Generates a rust source file from a cc_library and a header.
Expand All @@ -68,6 +69,7 @@ Generates a rust source file from a cc_library and a header.
| <a id="rust_bindgen-cc_lib"></a>cc_lib | The cc_library that contains the `.h` file. This is used to find the transitive includes. | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
| <a id="rust_bindgen-clang_flags"></a>clang_flags | Flags to pass directly to the clang executable. | List of strings | optional | `[]` |
| <a id="rust_bindgen-header"></a>header | The `.h` file to generate bindings for. | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
| <a id="rust_bindgen-merge_cc_lib_objects_into_rlib"></a>merge_cc_lib_objects_into_rlib | When True, objects from `cc_lib` will be copied into the `rlib` archive produced by the rust_library that depends on this `rust_bindgen` rule (using `BuildInfo` provider) | Boolean | optional | `True` |
| <a id="rust_bindgen-wrap_static_fns"></a>wrap_static_fns | Whether to create a separate .c file for static fns. Requires nightly toolchain, and a header that actually needs this feature (otherwise bindgen won't generate the file and Bazel complains). | Boolean | optional | `False` |


Expand Down
4 changes: 3 additions & 1 deletion test/bindgen/bindgen_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_rust//bindgen:defs.bzl", "rust_bindgen_library")
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library")
load("@rules_rust//rust:defs.bzl", "rust_binary")
load("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite")

def _test_cc_linkopt_impl(env, target):
Expand Down Expand Up @@ -65,6 +65,7 @@ def _test_cc_lib_object_merging(name):
cc_lib = name + "_cc",
header = "simple.h",
tags = ["manual"],
edition = "2021",
)

analysis_test(
Expand All @@ -82,6 +83,7 @@ def _test_cc_lib_object_merging_disabled(name):
header = "simple.h",
tags = ["manual"],
merge_cc_lib_objects_into_rlib = False,
edition = "2021",
)

analysis_test(
Expand Down

0 comments on commit 5379a11

Please sign in to comment.