Microsoft seems to be relying more and more on Rust. Microsoft introduces the preview of Rust for Windows.
Rust for Windows is a crate — in Rust, a crate is a compilation unit that can be compiled into either a binary or a library. It should make it possible to address and use any Windows API, regardless of whether it is an old, current, or future one, from within Rust.
The project was started by Kenny Kerr, a leading software engineer at Microsoft and actually a C++ specialist, in November 2019.
This Rust for Windows crate was built using Microsoft’s win32metadata project. The win32metadata project aims to provide metadata for Win32 APIs. This metadata describes the API surface — signatures, parameters, and strongly typed API types. This allows the entire Windows API to be fully automated for consumption by Rust in this case, but also many other languages.
Microsoft would also like to use more Rust internally in the future, as it was already analyzed in 2019 that 70 percent of all security-related bugs can be traced back to the insecure memory management of C++. That’s why Microsoft now also offers a course to help you get started with Rust. The course should cover installation, basic concepts, error handling, memory management, generic types, and traits, as well as creating modules for crates and writing automatic tests.
Rust was developed by Mozilla Research with the aim of avoiding program errors that could lead to memory access errors or buffer overflow and thus represent a security problem. At the same time, in terms of runtime, the language should achieve efficiency comparable to that of C++.
Along with AWS, Huawei, Google, and Mozilla, Microsoft is one of the five founding companies of the Rust Foundation, the establishment of which was announced on February 8, 2021, after Mozilla had to lay off a large part of the Rust core team in 2020.
In terms of syntax, Rust is based on C++ but also contains significant differences, such as no brackets around If-conditions. Recently, Rust has been integrated into an important development branch of the Linux kernel.