The Rustacean Station Podcast

This Week in Rust - Issue 345

Episode Page with Show Notes

Nell Shamrell-Harrington: Greetings and welcome to another episode of This Week in Rust on the Rustacean Station! As always, I’m Nell Shamrell-Harrington, lead editor of the This Week in Rust newsletter. I’m also a Sr. Staff Research Engineer on the Rust team at Mozilla.

Let’s dive right into some featured stories from This Week in Rust issue number 345 published June 30, 2020.

If you are finding yourself getting frustrated with long build times for your Rust projects, you should check out the article “Faster Rust Development on AWS EC2 with VSCode” by Max from New Zealand. This article covers how the author set up a development environment in AWS to build Rust Lamdba functions. It also covers some specifics for using the development environment with Visual Studio Code - such as setting it up to start and stop the Rust EC2 instance directly from the IDE.

Our next featured article is “Rust Verification Tools” by Alastair Reid. It covers the four major categories of formal software verification tools and how each can be used to verify Rust. These four major categories are symbolic execution tools, automatic verification tools, auto-active verification tools, and deductive verification tools. Additionally, the article also covers some tools that are not formal verification tools, but still useful when verifying Rust code.

This week we feature two articles about the Rocket web framework. The Rocket web framework, among other things, contains my favorite Rust function of all — Rocket Ignite. Saim Irfan’s article “Extremely Simple Rust Rocket Framework Tutorial” takes the reader through the basics of Rocket. These basics include adding attributes, making the main function, creating routes, returning HTML, creating additional Rust functionality, and more. This is a great article for newcomers to the Rocket web framework.

Additionally, Joe Previte has published another great blog post titled “Build a Smart Bookmarking Tool with Rust and Rocket”. In this post they take an internal Facebook bookmarking tool called “bunny1” and re-implement it using Rust and Rocket. On a personal note, as the very proud parent of three pet bunnies, I heartily approve the name of this tool. This article is a very detailed walkthrough through both basic and more advanced Rocket concepts. It also covers testing the app locally and deploying it to Heroku.

In security news, the National Cybersecurity Agency of France has published “Secure Rust guidelines.” In their own words, “the object of this document is to compile hints and recommendations to stay in a safe zone for secure applications development while taking advantage of the range of possibilities the Rust language can offer.” Along with an explanation of Rust concepts and how security affects them, they also include a checklist for developing Rust applications securely.

Much of the tech world was abuzz with Apple’s recent announcement that they are moving from Intel x86 CPU’s to their own ARM CPU’s. Nick Wilcox covers this in the article “Examining ARM vs x86 Memory Models with Rust”. One of the main ways ARM CPU’s differ from x86 CPU’s is through their memory models. Read this article for information on what a memory model is and the difference between writing multi-threaded programs on x86 CPU’s and ARM CPU’s.

For videos, we have another fantastic stream from Ryan Levick on iterators. To quote the video description “In this stream meant for intermediate Rustaceans we go behind the scenes of iterators by implementing our own version of the Iterator trait along with several other bits of functionality you’re probably already familiar with from the standard library. By the end of the stream hopefully iterators are a bit less mysterious”.

Additionally, Rust Wroclaw, a meetup group out of Wroclaw, Poland, has published a webinar from Michalina Kotwica on “Manipulating ports, virtual ports, and pseudo terminal”.

Moving on to calls for participation, this week we have three projects looking for contributors. These include the database project — a database management system written in Rust, Gooseberry — a command line interface to generate a knowledge-base wiki without having to actually type your knowledge out, and Ruma — a set of Rust library crates for working with the Matrix online communication protocol.

If you have wanted to get involved in open source Rust development but haven’t known where to start, definitely check out these projects and get your pull requests in.

During this past week we saw quite a bit of activity in Rust RFCs.

Four new RFCs have been proposed.

The first of these, “Crates.io token scopes”, proposes expanding the functionality of API tokens on Crates.io. This new functionality would allow someone to scope the tokens and specify which endpoints the token is allowed to call and which crates it’s allowed to affect. This would decrease the risk of automation bugs when tokens are used in CI scenarios and also decrease the risk of token compromise.

The next new RFC is called “Linking modifiers for native libraries”. It proposes that Rust provide an extensible mechanism for tweaking linking behavior of native libraries both in link attributes and on the command line. Check out the RFC for more details.

The third new RFC, “Portable packed SIMD vector types”, concerns, as you can likely glean from the title, SIMD — or Single Instruction, Multiple Data — vector types. It proposes bringing functionality from the packet_simd crate into the standard library.

The final new RFC for this week is titled “Hierarchic anonymous life-time”. It proposes adding into the Rust language the ability to reference struct fields with anonymous lifetimes. There has been quite a bit of discussion on this RFC and I highly recommend you give it a read.

Two RFCs have moved into FCP or Final Comment Period this week.

The first is titled “Inline Constant Expressions and Patterns.” This RFC introduces a new syntax which instructs the compiler to execute the contents of a block at compile time. An inline constant can be used as an expression or anywhere in a pattern where a named constant would be allowed

The other RFC is titled “Inline Assembly.” To quote it “In systems programming some tasks require dropping down to the assembly level. The primary reasons are for performance, precise timing, and low level hardware access. Using inline assembly for this is sometimes convenient, and sometimes necessary to avoid function call overhead. The inline assembler syntax currently available in nightly Rust is very ad-hoc. It provides a thin wrapper over the inline assembly syntax available in LLVM IR. For stabilization a more user-friendly syntax that lends itself to implementation across various backends is preferable.” This RFC proposes a more user friendly syntax for including inline assembly in Rust code. I encourage you to read the RFC for full details.

Finally, an RFC was approved this week. This one is called “Deduplicate Cargo workspace information”. Cargo workspaces are a feature of Cargo that allow you to manage multiple related packages in one place. A problem with workspaces as they are now is often multiple packages depend on the same external crates. At the moment each package in a workspace must specify its dependencies in its individual cargo manifest, even when it shares the exact same dependency with other packages. This RFC, among other things, adds a workspace dependencies section to a workspace’s Cargo.toml file, which greatly reduces the overhead of managing the dependencies of multiple packages in a workspace. Check out the RFC for the rest of the improvements to workspaces.

Moving on to events, there are again remote meetups happening across the world — including Berlin, Germany, Johannesburg, South Africa, Dublin, Ireland, Indianapolis, Indiana, and in my own hometown of Seattle, Washington. All of these are being held online and I encourage you to join them and meet Rustaceans from around the world.

There are also a few meetups being held in person — including in Dallas, Texas, Atlanta, Georgia, Lehi, Utah, and Auckland, New Zealand.

And that’s all for this episode of the This Week in Rust podcast. Make sure to read the newsletter for even more great Rust content.

This Week in Rust is edited by myself, Andre Bogus, and Colton Donnelly. This week’s contributors included, using their GitHub usernames, Jacobkrueger, Nickwilcox, Alex-duckhno, Garrensmith, Jsjoeio, nikhilm.

Thank you so much to everyone who contributes to This Week in Rust, you are the reason we can do this newsletter and podcast!

I will be back next week bringing you more of the wonderful news from the wonderful world of Rust. Until then, please take care.