Experiments with Rust: Microsoft presents a public preview of Rust / WinRT



[ad_1]

Rust / WinRT, a new tool for creating voice projections for Windows Runtime (WinRT), is available as a public preview on GitHub. Analogous to how C ++ / WinRT works, the tool will use standard languages ​​and compilers to create language projections in the future, which Rust developers can use to call any WinRT API to create desktop applications and Windows components in Rust. . The code can be generated “on the fly” directly from the metadata of the respective API and integrated as a new oxide module in the used oxide package.

An example of Rust’s call to a Windows API would be the following code, which can be used to parse and verify a simple XML document:

use windows::data::xml::dom::*;

let doc = XmlDocument::new()?;
doc.load_xml("hello world")?;

let root = doc.document_element()?;
assert!(root.node_name()? == "html");
assert!(root.inner_text()? == "hello world");

The preview is still in a very early experimental stage. Microsoft is sending a clear signal in the direction of the Rust community: In the future, the company should increasingly rely on Rust as a programming language in addition to C ++. Modern C ++ is generally considered particularly secure, but larger projects are therefore more difficult to implement. According to Microsoft, Rust resembles C ++ on several levels. Regarding compilation, runtime model, and type system, it obviously better meets the requirements for larger projects.

The downside to Rust is that the learning curve, which users still perceive as steep, remains. On the other hand, the effort might be worth it for Windows developers, as Rust apparently has the potential to solve some basic issues that C ++ projects regularly struggle with. In particular, according to Microsoft, Rust should ensure memory security with secure concurrency.

Microsoft has been experimenting with Rust for a long time: this is how projects to rewrite low-level Windows components that were originally written in C and C ++ run. Microsoft developed Under the project name Verona, a new, probably oxide-based language for secure infrastructure programming with a new proprietary model, as Matthew Parkinson of the Cambridge Computer Lab announced at a legacy and security conference at Microsoft in late 2019.

You can find more information about the Rust / WinRT preview at Find the announcement on the Microsoft blog. The Rust / WinRT code is available on GitHub. Also on GitHub is the example of the Minesweeper demo application cover to Rust. Programmer Robert Mikhayelyan originally wrote the game in C ++.


(Yes H)

To the home page

[ad_2]