Microsoft Offers Rust For Windows |
Written by Mike James | |||
Monday, 19 April 2021 | |||
Rust seems to be the great saviour of programming at the moment and Microsoft is the latest to jump on the bandwagon with Rust for Windows. I'm not saying that jumping on the Rust bandwagon is a bad thing, but Microsoft makes an interesting travel companion. In the recent Microsoft world there were only two languages - C++ as a systems programming language and C# for everything else. After the Windows 8 meltdown Microsoft became omnivorous when it came to languages - adopting JavaScript, Python and anything that came into view. The question remains if Rust is just another language to add to the collection Microsoft thinks are OK to support. For example, there is the Get Started with series of tutorials - Get Started with - Python, Node.js, Android, C++, C#, Docker, PowerShell, Database and now Rust. However, in the middle of all of this is that piece of news that we now have Rust For Windows. This isn't just using Rust to develop some generic console program, but a project to present the Windows API to a Rust program via the windows crate. This seems to include everything from basic windowing functions to Xaml. This is all possible because of the Windows metadata project, which describes the API in a machine readable form which can automatically be converted into Rust: That Microsoft might have a play around with Rust isn't a surprise, but this is the first time Microsoft has shown affection for a language that could replace C++ in building Windows and many Windows tools and applications. There has been much recent talk about letting Rust into the Linux kernel, could it be that the Windows team is thinking the same thoughts? If past experience is anything to go by, they are probably closing ranks and defending C++ a vigorously as possible - still doesn't mean it won't happen. On the other hand, you have to be slightly sad to see the first example on the Windows Rust site. It starts well enough: fn main() -> windows::Result<()> { let doc = XmlDocument::new()?; doc.LoadXml("<html>hello world</html>")?; let root = doc.DocumentElement()?; assert!(root.NodeName()? == "html"); assert!(root.InnerText()? == "hello world"); but then we crash into: unsafe { let event = CreateEventW(std::ptr::null_mut(), There is little point in adopting Rust if you are going to have to resort to "unsafe" the first time anything looks tricky. Is Rust for Windows able to avoid unsafe enough of the time to make it worth considering. Interesting question... More InformationRust for Windows, and the windows crate Related ArticlesGoogle Supports Rust For Android OS Development Is Microsoft Planning To Replace Rust? Daily Rust Use Increases, Survey Finds Rust 2018 Released To Improve Developer Productivity Rust Is Safer But Do We Use It Safely Oxide - A Simpler Formalized Rust To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info
|
|||
Last Updated ( Tuesday, 04 May 2021 ) |