Microsoft has announced an early public preview of Rust/WinRT, or Rust for the Windows Runtime (WinRT), and has posted it on GitHub.
The Rust/WinRT project is a “WinRT language projection” or software library for Rust, spearheaded by Kenny Kerr, a principal software engineer on Microsoft’s Windows Developer Platform team.
Kerr announced the Rust/WinRT project in November, stating his intent was to “build complete and deep support for WinRT in a way that is natural and familiar for the Rust developer”.
SEE: How to build a successful developer career (free PDF)
Rust/WinRT should make it easier for Rust developers to build Windows desktop apps, store apps, and components like device drivers.
“Rust/WinRT lets you call any WinRT API past, present, and future using code generated on the fly directly from the metadata describing the API and right into your Rust package where you can call them as if they were just another Rust module,” Kerr said in a new post.
The project follows Microsoft’s earlier C++/WinRT library for the Windows Runtime, which allows developers to write UWP and Win32 Windows apps. Both libraries provide access to the Windows Runtime Component Object Model APIs.
The language projections use the metadata describing those APIs and provide bindings for the target programming language.
“As you can imagine, this allows developers to more easily build apps and components for Windows using their desired language. You can then use those Windows APIs to build desktop apps, store apps, or something more unique like a component, NT service, or device driver,” said Kerr.
He also notes some of the security advantages Rust has over C++, which is widely used at Microsoft.
“While [Rust] has its own unique learning curve, it also has the potential to solve some of the most vexing issues that plague C++ projects, and is designed from the ground up with memory safety and safe concurrency as core principles,” he notes.
He believes that Rust could solve issues with C++’s relationship to WinRT.
The Rust/WinRT project adds one more thread to Microsoft’s exploration of Rust for its software tools. The company used Rust to rewrite low-level components of Windows originally written in C and C++, and is also looking to Rust’s memory-safety features to create a new language for ‘safe infrastructure programming’ under Project Verona.
And this week Microsoft’s Azure engineers revealed why they chose to use Rust over Go to build software tools for the cloud.