Struct libbindgen::Builder [] [src]

pub struct Builder { /* fields omitted */ }

Configure and generate Rust bindings for a C/C++ header.

This is the main entry point to the library.

use bindgen::builder;

// Configure and generate bindings.
let bindings = try!(builder().header("path/to/input/header")
                             .whitelisted_type("SomeCoolClass")
                             .whitelisted_function("do_some_cool_thing")
                             .generate());

// Write the generated bindings to an output file.
try!(bindings.write_to_file("path/to/output.rs"));

Methods

impl Builder
[src]

Set the input C/C++ header.

Generate a C/C++ file that includes the header and has dummy uses of every type defined in the header.

Hide the given type from the generated bindings.

Treat the given type as opaque in the generated bindings.

Whitelist the given type so that it (and all types that it transitively refers to) appears in the generated bindings.

Whitelist the given function so that it (and all types that it transitively refers to) appears in the generated bindings.

Whitelist the given variable so that it (and all types that it transitively refers to) appears in the generated bindings.

Mark the given enum (or set of enums, if using a pattern) as being bitfield-like.

This makes bindgen generate a type that isn't a rust enum.

Add a string to prepend to the generated bindings. The string is passed through without any modification.

Add an argument to be passed straight through to clang.

Make the generated bindings link the given shared library.

Make the generated bindings link the given static library.

Make the generated bindings link the given framework.

Emit bindings for builtin definitions (for example __builtin_va_list) in the generated Rust.

Avoid converting floats to f32/f64 by default.

Emit Clang AST.

Emit IR.

Enable C++ namespaces.

Disable auto-namespacing of names if namespaces are disabled.

By default, if namespaces are disabled, bindgen tries to mangle the names to from foo::bar::Baz to look like foo_bar_Baz, instead of just Baz.

This option disables that behavior.

Note that this intentionally doesn't change the names using for whitelisting and blacklisting, that should still be mangled with the namespaces.

Note, also, that using this option may cause duplicated names to be generated.

Ignore functions.

Ignore methods.

Avoid generating any unstable Rust in the generated bindings.

Use core instead of libstd in the generated bindings.

Use the given prefix for the raw types instead of ::std::os::raw.

Allows configuring types in different situations, see the TypeChooser documentation.

Choose what to generate using a CodegenConfig.

Generate the Rust bindings using the options built up thus far.

Trait Implementations

impl Debug for Builder
[src]

Formats the value using the given formatter.

impl Default for Builder
[src]

Returns the "default value" for a type. Read more