0.1.7 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
MIT - MIT Licensewindows-rs lets you call Windows APIs - past, present, and future - directly from Rust. It is not
a single crate but a family of them, from low-level API access to high-level declarative UI. This
page helps you find the right crate for the job; each crate's own documentation then covers how to
use it, with examples.
Most of these crates are small and focused - string types, error handling, the registry,
collections, and so on - and you depend only on what you actually use. For broad, exploratory access
to the entire Windows API surface, the windows and
windows-sys crates project everything past, present, and future, gated
behind per-namespace features.
For most projects, prefer the focused crates below, and generate a minimal, project-specific binding
with windows-bindgen for any additional APIs you need.
Start with what you are trying to do and add the smallest crate that covers it. Follow the link for usage and examples.
| If you need | Use |
|---|---|
Windows error handling (HRESULT, Error, Result) |
windows-result |
Windows string types and macros (HSTRING, PCWSTR, h!, w!, s!) |
windows-strings |
COM/WinRT type support (IUnknown, the Interface trait, cast, GUID) |
windows-core |
| To declare or implement a COM/WinRT interface |
windows-core (#[interface] / #[implement]) |
Stock WinRT collections (IVector, IMap) |
windows-collections |
WinRT values (IReference<T>, TimeSpan, DateTime) |
windows-reference, windows-time |
| Graphics math (vectors, matrices) | windows-numerics |
| WinRT async bridged to Rust futures | windows-future |
| The Win32 thread pool | windows-threading |
| The Windows registry | windows-registry |
| To author a Windows service | windows-services |
| The OS version at runtime | windows-version |
To link C-style functions without import libs (link!, raw-dylib) |
windows-link |
| To generate your own focused bindings | windows-bindgen |
| A declarative WinUI 3 UI, 2D graphics, a WebView, or a window | windows-reactor, windows-canvas, windows-webview, windows-window |
The full categorized index follows. Each crate has one page under crates/ covering both
usage and internals - how the crate is built and maintained (the tool_bindings / tool_reactor /
tool_package codegen pipeline, generated files, and conventions). Each crate's own readme.md is
the user-facing introduction with a quick example, and the per-crate page links to it. Item-level
API reference is the generated rustdoc on docs.rs, linked from every page.
| Crate | Description |
|---|---|
| windows-core | Fundamental COM and Windows type support, including the #[interface] / #[implement] authoring macros. |
| windows-result | Windows error handling and propagation. |
| windows-strings | Windows string interop types and macros. |
The #[interface] and #[implement] macros are part of windows-core, split into the
windows-interface and
windows-implement crates only because Rust requires procedural macros
to live in a dedicated proc-macro crate.
| Crate | Description |
|---|---|
| windows-numerics | Graphics math types (vectors and matrices). |
| windows-collections | Stock WinRT collection types. |
| windows-reference | Stock IReference<T> implementation. |
| windows-time | WinRT TimeSpan and DateTime. |
| Crate | Description |
|---|---|
| windows-future | WinRT async bridged to Rust futures. |
| windows-threading | Safe wrapper over the Win32 thread pool. |
| Crate | Description |
|---|---|
| windows-registry | Safe Windows registry access. |
| windows-services | Author Windows services in Rust. |
| windows-version | Query the Windows version at runtime. |
These crates package functionality that is part of other crates but must ship separately.
windows-interface and windows-implement are part of windows-core (see
above); Rust requires their proc macros to live in a dedicated proc-macro crate.
| Crate | Description |
|---|---|
| windows-implement |
#[implement] proc macro for COM/WinRT - part of windows-core. |
| windows-interface |
#[interface] proc macro for COM interfaces - part of windows-core. |
| windows-link | Raw-dylib import support (link!). |
| Crate | Description |
|---|---|
| windows-reactor | Declarative UI library backed by WinUI 3. |
| windows-canvas | 2D graphics built on Direct2D. |
| windows-composition | Retained-mode visual layer built on the Windows composition engine. |
| windows-webview | Safe wrapper around the WebView2 browser control. |
| windows-window | Minimal window creation and message loop. |
| windows-animation | Wrapper around the Windows Animation Manager. |
| windows-reactor-setup | Windows App Runtime installer for reactor apps. |
| Crate | Description |
|---|---|
| windows-bindgen | Code generator for Windows metadata. |
| windows-clang | Generates RDL from C/C++ headers using libclang. |
| windows-metadata | Low-level ECMA-335 metadata library. |
| windows-rdl | RDL parser and ECMA-335 generator. |
| riddle | Windows metadata compiler. |
| cppwinrt | Bundles the C++/WinRT compiler. |
These crates project the entire Windows API surface. For new projects, prefer a focused binding generated with windows-bindgen, or compose the smaller crates above.
| Crate | Description |
|---|---|
| windows | Safer projection of C-style, COM, and WinRT APIs. |
| windows-sys | Zero-overhead raw bindings for C-style Windows APIs. |