Treating a Type as an Opaque Blob of Bytes - 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

# Treating a Type as an Opaque Blob of Bytes

Sometimes a type definition is simply not translatable to Rust, for example it uses C++’s SFINAE for which Rust has no equivalent. In these cases, it is best to treat all occurrences of the type as an opaque blob of bytes with a size and alignment. `bindgen` will attempt to detect such cases and do this automatically, but other times it needs some explicit help from you.

### Library

- `bindgen::Builder::opaque_type`

### Command Line

- `--opaque-type <type>`

### Annotation

    /// <div rustbindgen opaque></div>
    class Foo {
        // ...
    };