Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

windows-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.

A family of crates

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.

Choosing your crates

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 interfacewindows-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 futureswindows-future
The Win32 thread poolwindows-threading
The Windows registrywindows-registry
To author a Windows servicewindows-services
The OS version at runtimewindows-version
To link C-style functions without import libs (link!, raw-dylib)windows-link
To generate your own focused bindingswindows-bindgen
A declarative WinUI 3 UI, 2D graphics, a WebView, or a windowwindows-reactor, windows-canvas, windows-webview, windows-window

Crates

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.

Core & error handling

CrateDescription
windows-coreFundamental COM and Windows type support, including the #[interface] / #[implement] authoring macros.
windows-resultWindows error handling and propagation.
windows-stringsWindows 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.

Values & collections

CrateDescription
windows-numericsGraphics math types (vectors and matrices).
windows-collectionsStock WinRT collection types.
windows-referenceStock IReference<T> implementation.
windows-timeWinRT TimeSpan and DateTime.

Async & threading

CrateDescription
windows-futureWinRT async bridged to Rust futures.
windows-threadingSafe wrapper over the Win32 thread pool.

System services

CrateDescription
windows-registrySafe Windows registry access.
windows-servicesAuthor Windows services in Rust.
windows-versionQuery the Windows version at runtime.

COM authoring macros & linking

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.

CrateDescription
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-linkRaw-dylib import support (link!).
windows-targetsImport libs for older compilers.

UI & graphics

CrateDescription
windows-reactorDeclarative UI library backed by WinUI 3.
windows-canvas2D graphics built on Direct2D.
windows-webviewSafe wrapper around the WebView2 browser control.
windows-windowMinimal window creation and message loop.
windows-animationWrapper around the Windows Animation Manager.
windows-reactor-setupWindows App Runtime installer for reactor apps.

Codegen & metadata tooling

CrateDescription
windows-bindgenCode generator for Windows metadata.
windows-metadataLow-level ECMA-335 metadata library.
windows-rdlRDL parser and ECMA-335 generator.
riddleWindows metadata compiler.
cppwinrtBundles the C++/WinRT compiler.

Full Windows API projection

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.

CrateDescription
windowsSafer projection of C-style, COM, and WinRT APIs.
windows-sysZero-overhead raw bindings for C-style Windows APIs.

关于 About

Rust for Windows
rustwindows

语言 Languages

Rust91.1%
HTML6.2%
C2.7%
C++0.0%
PowerShell0.0%
C#0.0%
HLSL0.0%
Batchfile0.0%
RenderScript0.0%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
656
Total Commits
峰值: 50次/周
Less
More

核心贡献者 Contributors