Skip to main content

Crate windows_bindgen

Crate windows_bindgen 

Source
Expand description

§bnd-bindgen

bnd-bindgen is bnd’s maintained fork of windows-bindgen. It generates Rust bindings from WinMD metadata and adds package-generation support used by bnd’s Linux and OpenSSL bindings.

The package keeps the upstream-compatible windows_bindgen Rust library name.

§Usage

[build-dependencies]
windows-bindgen = { package = "bnd-bindgen", version = "0.0.8" }
windows_bindgen::Bindgen::new()
    .input("example.winmd")
    .output("src/bindings.rs")
    .filter("example")
    .flat()
    .sys()
    .write();

Package mode can generate namespace-partitioned source files and Cargo features:

windows_bindgen::Bindgen::new()
    .input("example.winmd")
    .output("generated-package")
    .filter("example")
    .sys()
    .package()
    .package_feature_root("example")
    .write();

Use reference to route types owned by referenced WinMD metadata to an existing Rust crate or module instead of generating duplicate local definitions. ReferenceStyle::Full preserves the metadata namespace below the configured Rust crate path. The equivalent command-line form is --reference rust-path,full,metadata-filter.

Generated sys bindings require a compatible implementation of the windows_link macros. Bnd product crates use bnd-macros.

See VENDORED.md for the upstream revision, licensing, and the maintained fork changes.

§License

MIT or Apache-2.0

Structs§

Bindgen
Builder for generating Windows API bindings.

Enums§

ReferenceStyle
Controls how an external metadata namespace is appended to its Rust path.

Functions§

bindgen
Generates bindings using command-line-style arguments.
builder
Creates a new Bindgen builder for generating Windows API bindings.