Preventing the Derivation of Debug - The bindgen User Guide
Description: `bindgen` automatically generates Rust FFI bindings to C and C++ libraries.

## Keyboard shortcuts

Press `←` or `→` to navigate between chapters

Press `S` or `/` to search in the book

Press `?` to show this help

Press `Esc` to hide this help

# Preventing the Derivation of `Debug`

`bindgen` will attempt to derive the `Debug` traits on a best-effort basis. Sometimes, it might not understand that although adding `#[derive(Debug)]` to a translated type definition will compile, it still shouldn’t do that for reasons it can’t know. In these cases, the `nodebug` annotation can be used to prevent bindgen to autoderive the `Debug` traits for a type.

### Library

- `bindgen::Builder::no_debug`

### Command Line

- `--no-debug <regex>`

### Annotations

    /**
     * Although bindgen can't know, this enum is not safe to format the output.
     * the value may be combined with multiple bits in many C/C++ cases,
     * for example:
     *
     * <div rustbindgen nodebug></div>
     */
    enum AVRounding {
        AV_ROUND_ZERO     = 0,
        AV_ROUND_INF      = 1,
        AV_ROUND_DOWN     = 2,
        AV_ROUND_UP       = 3,
        AV_ROUND_NEAR_INF = 5,
        AV_ROUND_PASS_MINMAX = 8192,
    };

    // Prototype
    int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;

    // Call
    int64_t pts = av_rescale_rnd(40000, 3600, 90000, AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);