• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Blocklisting
2
3If you need to provide your own custom translation of some type (for example,
4because you need to wrap one of its fields in an `UnsafeCell`), you can
5explicitly blocklist generation of its definition. Uses of the blocklisted type
6will still appear in other types' definitions. (If you don't want the type to
7appear in the bindings at
8all, [make it opaque](./opaque.md) instead of
9blocklisting it.)
10
11Blocklisted types are pessimistically assumed not to be able to `derive` any
12traits, which can transitively affect other types' ability to `derive` traits or
13not.
14
15The `blocklist-file` option also allows the blocklisting of all items from a
16particular path regex, for example to block all types defined in system headers
17that are transitively included.
18
19### Library
20
21* [`bindgen::Builder::blocklist_file`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.blocklist_file)
22* [`bindgen::Builder::blocklist_function`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.blocklist_function)
23* [`bindgen::Builder::blocklist_item`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.blocklist_item)
24* [`bindgen::Builder::blocklist_type`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.blocklist_type)
25
26### Command Line
27
28* `--blocklist-file <path>`
29* `--blocklist-function <function>`
30* `--blocklist-item <item>`
31* `--blocklist-type <type>`
32
33
34### Annotations
35
36```cpp
37/// <div rustbindgen hide></div>
38class Foo {
39    // ...
40};
41```
42