• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Treating a Type as an Opaque Blob of Bytes
2
3Sometimes a type definition is simply not translatable to Rust, for example it
4uses
5[C++'s SFINAE](https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error) for
6which Rust has no equivalent. In these cases, it is best to treat all
7occurrences of the type as an opaque blob of bytes with a size and
8alignment. `bindgen` will attempt to detect such cases and do this
9automatically, but other times it needs some explicit help from you.
10
11### Library
12
13* [`bindgen::Builder::opaque_type`](https://docs.rs/bindgen/latest/bindgen/struct.Builder.html#method.opaque_type)
14
15### Command Line
16
17* `--opaque-type <type>`
18
19### Annotation
20
21```cpp
22/// <div rustbindgen opaque></div>
23class Foo {
24    // ...
25};
26```
27