The default Windows metadata used by the build-time crates.
- 📦 crates.io
- 📖 docs.rs
- 🚀 Getting started
- 📁 Source
windows-default embeds the canonical Windows Runtime and Windows API metadata as byte slices.
Build tools use WINRT and WIN32 when they need the standard metadata without locating separate
.winmd files.
Applications should use a focused crate, windows-bindgen, or, for binaries that want a broad
pre-generated surface, windows or windows-sys. Most code
generators should use input_default or reference_default on the builder they already use. Use
windows-default directly only when implementing a metadata tool that accepts in-memory winmd
bytes.
The crate exposes two static byte slices:
| Static | Embedded file | Contents |
|---|---|---|
WINRT |
Windows.winmd |
Windows Runtime contracts |
WIN32 |
Windows.Win32.winmd |
Windows SDK and WDK APIs |
Both files are included in the published crate and embedded with include_bytes!. The crate does
not extract files or perform I/O.
- Construct
windows_metadata::reader::Filevalues fromWINRTandWIN32. - Add component-specific winmd files.
- Build one
windows_metadata::reader::Indexover the combined files. - Query or transform the index without locating an SDK installation.
tool-reactor uses this pattern when its metadata resolver combines WinUI winmds with the standard
definitions. If you are compiling RDL or generating Rust, use the neighboring builder methods
instead; they already perform the byte-to-file conversion.
The build crates depend on windows-default and expose the metadata through their own builders.
Callers therefore do not need a separate dependency or a path into the Windows SDK.
| Crate | Default behavior |
|---|---|
windows-bindgen |
Implicit with no input; explicit with input_default. |
windows-rdl |
reference_default or writer input_default. |
windows-clang |
reference_default and WinRT-only resolution_default. |
windows-metadata |
Construct reader::File values from the slices. |
The windows-bindgen textual adapter accepts --in default. The bindgen, RDL, and Clang builders
use explicit default methods instead; their path-style input methods treat "default" as an
ordinary path. Byte-input APIs remain available for custom metadata that is already in memory.
Programs that link one of these build crates include both metadata payloads in the binary. These crates are intended for build tools rather than runtime dependencies.
WIN32is one flatWindows.Win32metadata set. Publishedwindowsandwindows-sysfeature namespaces are created later bytool-package.- Adding any explicit bindgen input disables the implicit default input. Call
input_defaultwhen the custom metadata references standard types. reference_defaultandresolution_defaultare not synonyms inwindows-clang. The former can suppress already-defined declarations; the latter only classifies WinRT ABI projections.- Linking this crate embeds both payloads even if the tool reads only one static.
- The bytes are build inputs. They do not provide Windows DLLs or make an API available on the running operating system.
The remainder of this page covers how the crate is built and maintained. It is for contributors and
is not needed to use windows-default.
The crate has no dependencies. src/lib.rs exposes each committed .winmd through
include_bytes!.
| File | Generator | Reviewable source |
|---|---|---|
Windows.winmd |
cargo run -p tool-winrt |
metadata/winrt |
Windows.Win32.winmd |
cargo run -p tool-win32 |
metadata/win32 and metadata/wdk |
tool-winrt merges the Windows SDK contract metadata, writes canonical RDL, and compiles that RDL
back to Windows.winmd. tool-win32 scrapes the Windows SDK and WDK headers for X64, Arm64, and
X86, merges the architecture-specific RDL, and writes Windows.Win32.winmd.
See Dependencies for the package versions and provenance.
The repository .gitignore normally excludes .winmd files, with an exception for this crate's
two committed payloads. Cargo packages tracked files by default, so Cargo.toml does not need a
separate include list. cargo package -p windows-default must contain both .winmd files.
The metadata is exercised through its consumers:
test_bindgen,test_rdl, andtest_clangcover default and byte inputs.tool-winrt,tool-win32, andtool-roundtripverify deterministic metadata generation.- The
tool-ymlgenerated workflows build and documentwindows-defaultlike the other library crates.
After changing the payloads or their generators, run the owning generator and confirm that the other generators remain output-neutral.