Microsoft’s windows-rs project ships focused Rust crates for COM, WinRT, system services, graphics, and UI on Windows, plus tools to generate bindings.
Overview
windows-rs provides Rust crates that wrap Windows APIs, from COM and WinRT interop through registry, services, and version queries to WinUI-style UI, Direct2D canvas, text layout, WebView2, windowing, and pickers. Supporting crates cover strings, errors, collections, numerics, time, futures, and threading.
Binary applications can pull broad coverage through umbrella windows or windows-sys crates behind feature flags, while shared libraries are advised to depend on smaller focused crates or generate private bindings with windows-bindgen to limit dependency weight and version clashes.
Metadata and codegen crates read and write ECMA-335 metadata, parse RDL, embed defaults for build tools, and integrate with Clang for header-driven generation. Macro crates implement attributes exposed through windows-core for COM and WinRT authoring.
Each crate documents setup, examples, and usage links. windows-bindgen remains the path when focused crates do not cover needed APIs; windows and windows-sys offer pre-generated typed or raw C-style bindings for applications.
Key features
- Focused crates for COM and WinRT
- Umbrella windows and windows-sys bindings
- windows-bindgen metadata codegen
- WinUI reactor and Direct2D canvas
- WebView2 and window management
- Registry and Windows services helpers
- Async WinRT futures support
- Clang-based RDL generation
Use cases
- Calling WinRT APIs from Rust
- Building native Windows desktop UI
- Generating minimal API bindings
- Sharing Windows types across crates