Table of Contents

Rust in Action, 1st Edition, Table of Contents

See Rust in Action, 1st Edition


Return to Rust outline, Rust, Rust bibliography, Rust courses, Rust terms, Rust topics

“ (RiA1)

Fair Use Sources

Fair Use Sources:


Brief Table of Contents

PART 1 RUST LANGUAGE DISTINCTIVES

PART 2 DEMYSTIFYING SYSTEMS PROGRAMMING

Detailed Table of Contents

Part 1 Rust language distinctives

Simplifying object creation by implementing new()

Modifying a known global variable

Making use of the Result return type

Using an enum to manage internal state

Creating a Read trait

Implementing std::fmt::Display for your own types

Protecting private data

Using rustdoc to render docs for a single source file

Using cargo to render docs for a crate and its dependencies

Encountering our first lifetime issue

Special behavior of primitive types

Use references where full ownership is not required

Use fewer long-lived values

Duplicate the value

Wrap data within specialty types

Part 2 Demystifying systems programming

Understanding endianness

Looking inside an f32

Isolating the sign bit

Isolating the exponent

Isolate the mantissa

Dissecting a floating-point number

CPU RIA/1: The Adder

Full code listing for CPU RIA/1: The Adder

CPU RIA/2: The Multiplier

CPU RIA/3: The Caller

CPU 4: Adding the rest

Raw pointers in Rust

Rust’s pointer ecosystem

Smart pointer building blocks

The stack

The heap

What is dynamic memory allocation?

Analyzing the impact of dynamic memory allocation

Background

Step 1: Having a process scan its own memory

Translating virtual addresses to physical addresses

Step 2: Working with the OS to scan an address space

Step 3: Reading from and writing to process memory

Writing data to disk with serde and the bincode format

Opening a file in Rust and controlling its file mode

Interacting with the filesystem in a type-safe manner with std::fs::Path

The key-value model

Introducing actionkv v1: An in-memory key-value store with a command-line interface

Tailoring what is compiled with conditional compilation

Initializing the ActionKV struct

Processing an individual record

Writing multi-byte binary data to disk in a guaranteed byte order

Validating I/O errors with checksums

Inserting a new key-value pair into an existing database

The full code listing for actionkv

Working with keys and values with HashMap and BTreeMap

Creating a HashMap and populating it with values

Retrieving values from HashMap and BTreeMap

How to decide between HashMap and BTreeMap

Adding a database index to actionkv v2.0

What do trait objects enable?

What is a trait object?

Creating a tiny role-playing game: The rpg project

What is a port number?

Converting a hostname to an IP address

Issue: Unable to return multiple error types

Wrapping downstream errors by defining our own error type

Cheating with unwrap() and expect()

Generating MAC addresses

Representing time zones

Refactoring the clock v0.1.0 code to support a wider architecture

Formatting the time

Providing a full command-line interface

clock v0.1.1: Full project

Common behavior

Setting the time for operating systems that use libc

Setting the time on MS Windows

clock v0.1.2: The full code listing

Sending NTP requests and interpreting responses

Adjusting the local time as a result of the server’s response

Converting between time representations that use different precisions and epochs

clock v0.1.3: The full code listing

Introduction to closures

Spawning a thread

Effect of spawning a few threads

Effect of spawning many threads

Reproducing the results

Shared variables

How to run render-hex and its intended output

Single-threaded render-hex overview

Spawning a thread per logical task

Using a thread pool and task queue

Threads

What is a context switch?

Processes

WebAssembly

Containers

Why use an operating system (OS) at all?

Setting up a development environment for developing an OS kernel

Verifying the development environment

First boot

Compilation instructions

Source code listings

Panic handling

Writing to the screen with VGA-compatible text mode

_start(): The main() function for FledgeOS

Being power conscious by interacting with the CPU directly

fledgeos-1 source code

Handling exceptions properly, almost

fledgeos-2 source code

Writing colored text to the screen

Controlling the in-memory representation of enums

Why use enums?

Creating a type that can print to the VGA frame buffer

Printing to the screen

fledgeos-3 source code

Implementing a panic handler that reports the error to the user

Reimplementing panic() by making use of core::fmt::Write

Implementing core::fmt::Write

fledge-4 source code

Signals vs. interrupts

Default behavior

Suspend and resume a program’s operation

Listing all signals supported by the OS

Global variables in Rust

Using a global variable to indicate that shutdown has been initiated

Understanding function pointers and their syntax

Introducing the sjlj project

Setting up intrinsics in a program

Casting a pointer to another type

Compiling the sjlj project

sjlj project source code

“ (RiA1)

Fair Use Sources

Fair Use Sources: