Rust for Windows
Rust for Windows, and the windows crate

	
		Skip to main content

		
				This browser is no longer supported.
				Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
				
			
		

		
		
			
			
			
		
	

	

						
							
							

							Rust for Windows, and the windows crate
											Article08/11/2023
															
															
														
										
											In this article
										

Introducing Rust for Windows
In the Overview of developing on Windows with Rust topic, we demonstrated a simple app that outputs a Hello, world! message. But not only can you use Rust on Windows, you can also write apps for Windows using Rust.
You can find all of the latest updates in the Release log of the Rust for Windows repo on GitHub.
Rust for Windows lets you use any Windows API (past, present, and future) directly and seamlessly via the windows crate (crate is Rust's term for a binary or a library, and/or the source code that builds into one).
Whether it's timeless functions such as CreateEventW and WaitForSingleObject, powerful graphics engines such as Direct3D, traditional windowing functions such as CreateWindowExW and DispatchMessageW, or more recent user interface (UI) frameworks such as Composition, the windows crate has you covered.
The win32metadata project aims to provide metadata for Win32 APIs. This metadata describes the API surface—strongly-typed API signatures, parameters, and types. This enables the entire Windows API to be projected in an automated and complete way for consumption by Rust (as well as languages such as C# and C++). Also see Making Win32 APIs more accessible to more languages.
As a Rust developer, you'll use Cargo (Rust's package management tool)—along with https://crates.io (the Rust community's crate registry)—to manage the dependencies in your projects. The good news is that you can reference the windows crate from your Rust apps, and then immediately begin calling Windows APIs. You can also find Rust documentation for the windows crate over on https://docs.rs.
Similar to C++/WinRT, Rust for Windows is an open source language projection developed on GitHub. Use the Rust for Windows repo if you have questions about Rust for Windows, or if you wish to report issues with it.
The Rust for Windows repo also has some simple examples that you can follow. And there's an excellent sample app in the form of Robert Mikhayelyan's Minesweeper.
Contribute to Rust for Windows
Rust for Windows welcomes your contributions!
Rust documentation for the Windows API
Rust for Windows benefits from the polished toolchain that Rust developers enjoy. But if having the entire Windows API at your fingertips seems a little daunting, there's also Rust documentation for the Windows API.
This resource essentially documents how the Windows APIs and types are projected into idiomatic Rust. Use it to browse or search for the APIs you need to know about, and that you need to know how to call.
Writing an app with Rust for Windows
The next topic is the RSS reader tutorial, where we'll walk through writing a simple app with Rust for Windows.


Overview of developing on Windows with Rust
RSS reader tutorial
The windows crate
Documentation for the windows crate
Win32 metadata
Making Win32 APIs more accessible to more languages
Rust documentation for the Windows API
Rust for Windows
Minesweeper sample app


							
							

						

						
				
					
						
					
					Collaborate with us on GitHub
				
				
					The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
				
			

						
								Additional resources
								
								
								
								
									In this article
								
								
							
	

	

	

