UNLIMITED

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
Subscribe!
UK readers turn to p16 2 GREAT WAYS TO SUBSCRIBE Print + NEW digital access or digital-only! » USA From $125.99 For 13 issues » REST OF THE WORLD From…
Linux Format3 min read
Ubuntu 24.10
Ubuntu 24.10 is the first interim release since 24.04, and in the past six months, 24.04 has improved from what was initially released. Ubuntu 24.10 offers a…
Linux Format1 min read
Video Stars
Italo Vignoli is one of the founders of LibreOffice and the Document Foundation. “LibreOffice 24.8 was announced in August, and at the same time the documentation team released the Getting Started Guide. This…

Related Books & Audiobooks