Rust Bytes: “Rust Is Powering Vercel’s Turborepo”

Rustaceans Editors
Rustaceans
Published in
3 min readFeb 18, 2024
Ferris the Crab, the unofficial mascot for Rust. by Jan Cibulka

Hello Rustacean! Welcome to another edition of the Rust Bytes newsletter. In this issue, we'll shine a spotlight on an amazing Rust project, present our spot-the-bug challenge, and share some incredible links of the week.

Subscribe to the newsletter on our Substack if you haven’t already!

Welcome to Issue 10!

Rust Pun

Why do Rust developers stay calm under pressure?

Because they know how to manage panics!

Main Thing

Rust Is Now Powering Turborepo

Turborepo is a high performance JavaScript and TypeScript build system. Originally written in Go, during its release, it was extremely fast and high perfomant in comparison to other build systems such as Vite. Developed by the Vercel team, known for popular frameworks like Next.js for React, Turborepo underwent a rewrite to harness Rust's capabilities, aiming to further enhance its performance.

While they had been undergoing a rewrite to help squeeze the performance and leverage the good parts provided by Rust they have finished the porting.

Check out what the Vercel team had to say in Finishing Turborepo's migration from Go to Rust.

Spot the Bug

Trait Trickery:

Identify why the code fails to compile and suggest a way to fix it while keeping the trait object.

Want to share your solution and be featured in our upcoming newsletter? Share your solution in the comments below, and to be included in the upcoming issue of the newsletter.

Project Spotlight

markdown-rs

Markdown-rs is a markdown parser written in Rust. The project complies with CommonMark and also provides support for MDX, math, and frontmatter.

Features:

  • Compliance: Fully compliant with CommonMark (100%).
  • Extensions: Supports 100% of GFM, 100% of MDX, frontmatter, and math.
  • Safety: Implemented in 100% safe Rust, generates 100% safe HTML by default.
  • Robustness: Includes 2300+ tests, achieves 100% coverage, and undergoes fuzz testing.
  • AST: Utilizes mdast.

The project is maintained by Titus and is open-source on GitHub.

Awesome links of the week

  1. Nicolas Fränkel wrote about -“Error management in Rust, and libs that support it” .
  2. The Kind team created “Kind: Costless visibly typed identifiers in Rust” - a demonstration on how to transition from UUIDs in the database to prefixed identifiers in REST/JSON APIs.
  3. Jeremy Steward blogged about “Cross-Compiling Your Project in Rust” which delves into the intricacies of cross-compilation in Rust, exploring its significance in scenarios such as embedded development and CI/CD pipelines.
  4. Denis Bazhenov wrote aboutPerformance Roulette: The Luck of Code Alignment
  5. Thomas Simmer wrote about “Rust: Reading a file line by line while being mindful of RAM usage where he discusses a performance optimization in Rust when reading large files line by line.
  6. Jan Cibulka wrote about “Rust Crash Course for the Impatient”.
  7. “From Go to Rust: The Two Types of Readable Code” by Adam Gordon Bell.
  8. “Why Rust? It's the safe choice.” an article by Erick discusses the benefits of using Rust for building intelligent robots at Matic Robots. He highlights Rust's advantages in performance, reliability, and safety, emphasizing its role in improving product quality and developer effectiveness.
  9. Tyler Mandry was nominated to join the Rust Lang Team as co-lead.
  10. “Building a (simple) Blog with Rust” from Hackernoon.

Spot The Bug: Solution

Explanation 


The code fails to compile because MyTrait is a trait object, and trait objects cannot be sized at compile time. Therefore, they must be used behind a reference (e.g., &dyn MyTrait) or a pointer (e.g., Box<dyn MyTrait>).


Solution:

To fix this, either change MyTrait to Box<dyn MyTrait> in the main function, or create a reference to MyStruct like let my_trait: &dyn MyTrait = &MyStruct;.

Before You Go

To support the newsletter:

That's all for now, Rustaceans! Until next week, have a productive week ahead.

--

--