tree: b110b77c68a5687d1e529924610fa7133a9c1b84 [path history] [tgz]
  1. default/
  2. src/
  3. .cargo-checksum.json
  4. Cargo.toml
  5. license-apache-2.0
  6. license-mit
  7. readme.md
vendor/windows-bindgen-0.58.0/readme.md

Generate Rust bindings for Windows

The windows-bindgen crate automatically generates Rust bindings from Windows metadata.

Start by adding the following to your Cargo.toml file:

[dependencies.windows-targets]
version = "0.52"

[dev-dependencies.windows-bindgen]
version = "0.58"

Generates Rust bindings in a build script or test as needed:

#[test]
fn bindgen() {
    let args = [
        "--out",
        "src/bindings.rs",
        "--config",
        "flatten",
        "--filter",
        "Windows.Win32.System.SystemInformation.GetTickCount",
    ];

    windows_bindgen::bindgen(args).unwrap();
}

mod bindings;

fn main() {
    unsafe {
        println!("{}", bindings::GetTickCount());
    }
}