The Rust programming language

Stijn Hering
Auraidata
Published in
11 min readFeb 27, 2023

Rust is a programming language that has gained significant popularity in recent years due to its focus on safety, performance, and concurrency. It was first released in 2010 by Graydon Hoare and has since become a popular choice for developers working on a wide range of projects, from operating systems to web servers to data analysis and CLI tools. Rust has been chosen as the “most loved” programming language for 7 years in a row according to the annual Stack Overflow Developer Survey. There are several reasons why Rust has gained such a strong following among developers. In this blog post, we will explore some of the key factors that have contributed to the rise of Rust and discuss some of the tools and applications that are written in Rust.

Ferris the crab (unofficial mascot for Rust)

Safety and Performance

One of the main reasons for the popularity of Rust is its focus on safety and performance. Rust is designed to be a safe and fast language, which makes it an ideal choice for a wide range of applications. It achieves this through a combination of static typing, ownership, and borrowing, which help to prevent common programming (memory) errors such as null or dangling pointer references. These concepts are very different from what developers are used to in other programming languages and make Rust particularly useful for tasks that require low-level control and performance, such as system programming and data processing.

Compiler

One of the main strengths of the Rust is its compiler and its focus on correctness and safety. The Rust language is designed to prevent common programming errors and security vulnerabilities, and the Rust compiler helps to enforce this by statically checking the code for correctness and safety at compile-time. This means that any issues with the code, such as null or dangling pointers and type errors, will be caught and flagged by the compiler before the program is even run. This not only helps to prevent bugs and crashes, but also helps to ensure that Rust programs are reliable and secure. In addition to these static checks, the Rust compiler also performs various optimizations to improve the efficiency and performance of the generated code.

The Rust compiler is designed to be helpful and user-friendly, and it provides various hints and suggestions to assist users in debugging and improving their code. When the compiler encounters an error or warning, it will provide a detailed message explaining the issue and how to fix it. In many cases, these messages will include specific suggestions or recommendations for how to resolve the problem. For example, if the compiler detects a type error, it may suggest changing the types of certain variables or adding a type annotation to disambiguate the issue. Overall, the Rust compiler is an essential tool for Rust programmers, helping to ensure that their programs are correct, efficient, and secure.

Compiler Hint Example (from a rustlings exercise)

Community

Another reason for the rise of Rust is its growing community of developers. Rust has a large and active community of developers who contribute to the language and its ecosystem. This community has created a substantial amount of libraries, tools, and resources that make it easier for developers to work with Rust, and create safe and reliable applications in Rust.

Rust was first introduced in 2010, making it a relatively new and “immature” programming language compared to more established languages such as C++(1979), Java(1995), Python(1991), and JavaScript/Typescript(1995); Typescript was introduced in 2012 as a strict syntactical superset of JavaScript that adds optional static typing to the language.

This “immature” status means that Rust is not as widely used and has a smaller community of contributors compared to these more established languages. In comparison to the C++, Java, Python, and JavaScript/Typescript communities, there are currently fewer libraries available for Rust, and those that do exist may be incomplete and in need of improvement or could benefit from more competition. Nevertheless, more and more new Rust projects are emerging that contribute to the innovation within the tech domain.

Another reason for Rust’s “immature” status is its focus on quality. Rust has a reputation for being a “hard” language to learn, with a steep learning curve and a high level of “rustiness” required to be productive. This is due to the fact that the Rust compiler demands “correctness” and “safety”, which inherently provides the safety, performance and concurrency the Rust language is known for. For new Rustaceans this can be intimidating and may discourage some people from getting involved in the community.

In conclusion, Rust is a programming language that has gained a lot of popularity due to its focus on safety and performance. Rust is already being used in a wide range of applications, including web browsers, text editors, databases and data processing frameworks and with the number of Rustaceans growing every day, more and more Rust tools, projects and libraries will be added to this existing tech stack. As a result, Rust is an important and growing language that is worth learning as a developer, data scientist, or data engineer.

Who is using Rust?

Many major companies are now using Rust internally. For example, Mozilla uses Rust in their Firefox web browser to improve the performance and security of the browser. Dropbox uses Rust in some of their server infrastructure to improve the performance and reliability of their services. Cloudflare, a company that provides web technologies, also uses Rust in some of their projects to improve performance and security. Figma, a popular online design and prototyping tool, uses Rust in their backend infrastructure. Discord, a communication platform for online communities, uses Rust in some of their server infrastructure to improve performance and reliability. Amazon Web Services (AWS) also uses Rust in some of their internal tools, such as the performance-sensitive components of services like Lambda, EC2, S3 and their Firecracker microvm; the latter is used to run lightweight virtual machines. Additionally, companies such as Microsoft, Intel, and Google are also exploring the use of Rust in various projects.

In addition to the introduction of Rust within the established tech corporations, the Rust language has allowed a large number of start-ups into the tech world that can shake up the status quo with their innovative next-generation Rust project. In conclusion, Rust has proven to be a valuable tool for these companies because of its ability to write secure and efficient code, making it a strong choice for building critical and reliable systems.

Rust Projects

Yew (the WebAssembly framework)

Yew is a Rust framework for creating web apps with WebAssembly. WebAssembly (WASM) is a low-level binary format that is designed to be run on the web. It was developed as a compilation target for languages such as C, C++, and Rust, allowing them to run on the web with near-native performance. WASM is supported by all modern browsers and is increasingly being used to build high-performance web applications. It is also being used as a target for programming languages that do not have native support for the web, allowing developers to build web applications using a wider range of languages. WASM is often used in conjunction with technologies such as WebGL and WebVR to build interactive and immersive experiences on the web.

Yew is a modern Rust framework for creating multi-threaded front-end web apps with WebAssembly. It has outstanding performance because of the multi-thread support, and JavaScript interoperability. It features a macro for declaring interactive HTML with Rust expressions, comparable to how JSX/TSX in React work, therefore developers who have experience with React should feel quite at home when using Yew. As of now, it is not production-ready but should be an excellent choice for side projects and internal tooling, especially if you want to work with WASM.

Deno (the NodeJS competitor)

Deno is a runtime for JavaScript and TypeScript that was built using the Rust programming language. It was created by Ryan Dahl who is the creator of Node.js (and a big Rust contributor), as a modern and secure alternative to Node.js. Deno uses Rust and the V8 JavaScript engine, the same engine that powers Google Chrome, to execute JavaScript and TypeScript code. Deno’s use of Rust allows it to take advantage of the language’s safety, performance, and concurrency capabilities, making it a secure and high-performance runtime for running JavaScript and TypeScript code.

WARP (next generation terminal)

Introducing Warp, a terminal built with Rust that aims to increase productivity and ease of use. The Warp team calls its terminal “the terminal for the 21st century” because of the following features. Warp is a full text editor for command input, complete with functionality such as text selection, A.I. command search, cursor positioning, and common shortcuts. In addition, commands and their output are organized into blocks for improved visual clarity. Warp also includes updates to common shortcuts like the up arrow and ctrl-r, command-lookup and visual-history all presented in easy-to-use menus blocks. Currently, Warp is only available for Mac OS, but the team has announced that they are working on creating Windows and Linux versions.

Rust projects for Data Engineers

Polars

Polars is an exceptionally fast dataframe library and in-memory query engine built in Rust. Its highly efficient algorithms and parallel execution capabilities, combined with its user-friendly API, make it ideal for tasks such as data wrangling, building data pipelines, and creating snappy APIs. Its capabilities extend beyond these uses as well.

Polars is written entirely in Rust (so no runtime overhead) and is built on the native Rust implementation of Apache Arrow (Arrow2). Apache arrow provides very cache efficient columnar data structures and is becoming the de facto standard for columnar data.
Polars is written from the ground up, designed for parallelization of queries on DataFrames. In addition it is optimized to:

  • Reduce redundant copies
  • Traverse memory cache efficiently
  • Minimize contention in parallelism

Polars has both lazy and semi-lazy features, allowing you to work with data in a manner similar to Pandas, while also providing a powerful expression syntax that can be optimized and executed within the query engine. Its lazy capabilities allow for optimization of the entire query, improving performance and reducing memory usage.

Polars Logo

Polars keeps track of your query in a logical plan, which is optimized and rearranged before execution. When a result is requested, the work is distributed to different executors using the algorithms provided by the eager API to produce the desired outcome. Because the optimizer and executors have access to the entire context of the query, processes that depend on separate data sources can be easily parallelized.

Because of this, Polars is fast, very freakishly fast[1][2] in fact if you compare it with other known DataFrame tools or libraries like Pandas, Dask or Apache Spark (when running in single machine mode). Polars probably won’t replace Spark (just yet!) but it certainly takes its place when it comes to medium size amounts of data that needs to be wrangled, where Pandas is too slow for the job and setting up Spark clusters too cumbersome.

Actix Web

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust. Actix Web makes it easy to build robust, high-performance web applications in Rust, thanks to its strong focus on simplicity, ease of use, and excellent documentation. It is also highly modular, allowing developers to easily extend and customize it to fit their specific needs. Overall, Actix Web is an excellent choice for anyone looking to build high-quality, secure and fast web applications in Rust.

Tauri

Tauri is a toolkit that helps developers make applications for the major desktop platforms — using virtually any frontend framework in existence. Tauri’s core is, ofcourse, built with Rust, and the CLI leverages Node.js making Tauri a genuinely polyglot approach to creating and maintaining great apps. Tauri is made with a security first approach, what this means is that Tauri lets you choose which API endpoints to ship, whether or not you want a localhost server built into your app, and it even randomizes functional handles at runtime, in addition it only ships applications to binaries. These and other techniques form a secure baseline that empowers you and your users.

SurrealDB

SurrealDB is an innovative NewSQL end-to-end cloud native database for web, mobile, serverless, Jamstack, backend, and traditional applications, written in (you guessed it) Rust! SurrealDB reduces the development time of modern applications by simplifying your database and API stack, removing the need for most server-side components, and allowing you to build secure, performant apps quicker and cheaper. SurrealDB acts as both a database and a modern, real-time, collaborative API backend layer. SurrealDB can run as a single server or in a highly-available, highly-scalable distributed mode, with support for SQL querying from client devices, GraphQL, ACID transactions, WebSocket connections, structured and unstructured data, graph querying, full-text indexing, geospatial querying, and row-by-row permissions-based access.

Meilisearch

And then last but not least; Meilisearch! Meilisearch is an open-source, user-focused search engine that easily integrates with any website or application. It features powerful built-in capabilities such as search-as-you-type, typo tolerance, faceted search, geo search, and multi-tenancy. A suite of SDKs and libraries makes it easy to connect with popular coding languages and web tools. Meilisearch is made to be a solution that could be used by anybody and is designed to suit a wide range of requirements. Installation requires very little configuration, yet it is highly customizable. It provides an immediate search experience with features such as typo correction, filters, custom ranks, and more.

Photo by Joe Dudeck on Unsplash

Wrapping things up

In conclusion, Rust is a relatively young programming language that has not yet reached the level of popularity and maturity of some other languages. However, it has a strong and growing community of users and developers, and it is likely that we will see more applications and tools being written in Rust in the coming years. This is due, in part, to the many appealing features that Rust offers, such as its emphasis on safety, performance, and concurrency. As Rust continues to mature and gain wider adoption, it may well become a mainstream language and a go-to choice for developers in a variety of contexts. Whether or not that happens remains to be seen, but one thing is clear: Rust is an exciting and promising language that is worth keeping an eye on.

Aurai provides custom data solutions that help companies gain insights into their data. We engineer your company’s future through simplifying, organizing and automating data. Your time is maximized by receiving the automated knowledge effortlessly and enacting better processes on a foundation of relevant, reliable, and durable information. Interested in what Aurai can mean for your organisation? Don’t hesitate to contact us!

--

--

Stijn Hering
Auraidata

Data-Engineer | Data-Scientist | Developer currently working for PostNL. Always eager to try new tech, competent in Python, Javascript/Typescript