Linux Format

Coding secure Rust system tools

Part One Don’t miss next issue! Subscribe on page 18

Rust has become a key language for the Linux kernel and beyond. This series on systems programming with Rust will cover the basics, including memory management, working with command line arguments and environment variables, the cargo tool and writing tests. You’ll learn how to work with files and directories, file I/O, UNIX processes, concurrency and network programming.

Installing Rust

You can use the package manager that comes with your Linux distribution to install Rust. On an Arch Linux machine, you can install Rust by running pacman -S rust with root privileges – this will also install the cargo tool (explained later on). New, stable Rust versions are released every six weeks) and sometimes without full backward compatibility. You can find out what version of Rust you’re using by executing rustc --version. Note: Rust source code files usually have the .rs file extension.

Data types

Let’s look at the basic data types of Rust and how you can define new variables. Because Rust is a statically typed language, it must know the types of all variables of a program at compile time. Additionally, Rust supports both mutable and immutable variables. All Rust variables are immutable unless defined otherwise.

The integer types of Rust have the i<bit> format for the signed versions and u<bit> format for the unsigned

You’re reading a preview, subscribe to read more.

More from Linux Format

Linux Format1 min read
Vector Vexations
Why does MySQL not support vectors in its community edition? Generative AI is the hot topic in tech. GenAI relies on vector data. Yet Oracle has no plans to support vectors in the community edition of MySQL. If you want to try out vector data with ot
Linux Format5 min read
Tips For Managing Docker Containers
Everyone knows how containers revolutionised application building and deployment. Using a E disposable stack of containers that make up an app that aren’t using the docker-compose command to manage the stack are missing a trick. It allows the shippin
Linux Format1 min read
Wine For Wayland
2023 was a great year for the Wayland driver for Wine. The goal was to move forward from the experimental phase and make the driver a proper upstream component. A year later, after several merge requests, many people are now already able to use the l

Related