• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Preventing the Derivation of `Debug`
2
3`bindgen` will attempt to derive the `Debug` traits on a best-effort
4basis. Sometimes, it might not understand that although adding `#[derive(Debug)]` to a translated type definition will compile, it still shouldn't do
5that for reasons it can't know. In these cases, the `nodebug` annotation can be
6used to prevent bindgen to autoderive the `Debug` traits for a type.
7
8### Library
9
10* [`bindgen::Builder::no_debug`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.no_debug)
11
12### Command Line
13
14* `--no-debug <regex>`
15
16### Annotations
17
18```c
19/**
20 * Although bindgen can't know, this enum is not safe to format the output.
21 * the value may be combined with multiple bits in many C/C++ cases,
22 * for example:
23 *
24 * <div rustbindgen nodebug></div>
25 */
26enum AVRounding {
27    AV_ROUND_ZERO     = 0,
28    AV_ROUND_INF      = 1,
29    AV_ROUND_DOWN     = 2,
30    AV_ROUND_UP       = 3,
31    AV_ROUND_NEAR_INF = 5,
32    AV_ROUND_PASS_MINMAX = 8192,
33};
34
35// Prototype
36int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;
37
38// Call
39int64_t pts = av_rescale_rnd(40000, 3600, 90000, AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
40```
41