rustc/vendor/windows-metadata-0.58.0
2024-09-09 14:07:22 +02:00
..
src New upstream version 1.81.0+dfsg1 2024-09-09 14:07:22 +02:00
.cargo-checksum.json New upstream version 1.81.0+dfsg1 2024-09-09 14:07:22 +02:00
Cargo.toml New upstream version 1.81.0+dfsg1 2024-09-09 14:07:22 +02:00
license-apache-2.0 New upstream version 1.81.0+dfsg1 2024-09-09 14:07:22 +02:00
license-mit New upstream version 1.81.0+dfsg1 2024-09-09 14:07:22 +02:00
readme.md New upstream version 1.81.0+dfsg1 2024-09-09 14:07:22 +02:00

Windows metadata reader

The windows-metadata crate provides a fast reader for Windows metadata files based on the ECMA-335 file format.

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

[dependencies.windows-metadata]
version = "0.58"

Read metadata as needed:

use windows_metadata::*;

fn main() {
    let bytes = std::fs::read(r#"C:\Windows\System32\WinMetadata\Windows.Foundation.winmd"#)
        .expect("File not found");

    let file = File::new(bytes).expect("Invalid metadata");

    let reader = Reader::new(vec![file]);

    for def in reader.get_type_def("Windows.Foundation", "IAsyncInfo") {
        println!("{}", def.name());

        for method in def.methods() {
            println!("{}", method.name());
        }
    }
}