Microsoft has released an update for Rust for Windows (formerly Rust/WinRT) with completed support for Win32 and COM APIs.
Version 0.9 of the Rust language projection turned up last week and, according to Microsoft, gives "access to the entire Windows API surface in a language-idiomatic way."
It's a tacit admission that no matter how much Microsoft might hope it will, the Win32 API does not seem to be going anywhere any time soon. Even the most beloved of languages will struggle to avoid a dip into the API of yesteryear if it is to run efficiently on the Windows platform.
El Reg gives it a spin
While it has been possible for the adventurous to delve into the API, "completed consumption" support makes things considerably easier. We had a crack at Microsoft's Hello World example using Visual Studio Code and found the process relatively straightforward, even if the download size of the components required dwarfed the diminutive message box.
The former "Rust/WinRT" label has been ditched in favour of "Rust for Windows" in this release and as well as support for Win32 and COM APIs in the windows crate (enabled by the win32metadata project) build times and error handling have been improved.
"To reduce build time, use a
bindings crate rather than simply a module," advised Microsoft. Not a bad idea – once Cargo had cached results, we found subsequent builds of our "Hello World" considerably snappier both from Visual Studio Code and command line.
Other changes include the preservation of original API case (which might affect existing code) and the ability to build the windows crate under Linux.
Rust topped the "loved" leaderboard in the 2020 Stack Overflow developer survey and Microsoft has been investing in making the venerable Win32 API (and its ilk) more accessible to fans of the language. As well as the update, an experimental documentation generator has been published along with a range of samples.
The update comes just over a year after the project's debut in preview form on GitHub and Microsoft talked up the project at the beginning of this year. The roadmap continues to call for the publication of the projection by the end of 2021. ®