Rust in Action
eBook - ePub

Rust in Action

Tim McNamara

Condividi libro
  1. 456 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Rust in Action

Tim McNamara

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

"This well-written book will help you make the most of what Rust has to offer." - Ramnivas Laddad, author of AspectJ in Action Rust in Action is a hands-on guide to systems programming with Rust. Written for inquisitive programmers, it presents real-world use cases that go far beyond syntax and structure. Summary
Rust in Action introduces the Rust programming language by exploring numerous systems programming concepts and techniques. You'll be learning Rust by delving into how computers work under the hood. You'll find yourself playing with persistent storage, memory, networking and even tinkering with CPU instructions. The book takes you through using Rust to extend other applications and teaches you tricks to write blindingly fast code. You'll also discover parallel and concurrent programming. Filled to the brim with real-life use cases and scenarios, you'll go beyond the Rust syntax and see what Rust has to offer in real-world use cases. Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications. About the technology
Rust is the perfect language for systems programming. It delivers the low-level power of C along with rock-solid safety features that let you code fearlessly. Ideal for applications requiring concurrency, Rust programs are compact, readable, and blazingly fast. Best of all, Rust's famously smart compiler helps you avoid even subtle coding errors. About the book
Rust in Action is a hands-on guide to systems programming with Rust. Written for inquisitive programmers, it presents real-world use cases that go far beyond syntax and structure. You'll explore Rust implementations for file manipulation, networking, and kernel-level programming and discover awesome techniques for parallelism and concurrency. Along the way, you'll master Rust's unique borrow checker model for memory management without a garbage collector. What's inside Elementary to advanced Rust programming
Practical examples from systems programming
Command-line, graphical and networked applications About the reader
For intermediate programmers. No previous experience with Rust required. About the author
Tim McNamara uses Rust to build data processing pipelines and generative art. He is an expert in natural language processing and data engineering. Table of Contents 1 Introducing Rust
PART 1 RUST LANGUAGE DISTINCTIVES
2 Language foundations
3 Compound data types
4 Lifetimes, ownership, and borrowing
PART 2 DEMYSTIFYING SYSTEMS PROGRAMMING
5 Data in depth
6 Memory
7 Files and storage
8 Networking
9 Time and timekeeping
10 Processes, threads, and containers
11 Kernel
12 Signals, interrupts, and exceptions

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Rust in Action è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Rust in Action di Tim McNamara in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatica e Linguaggi di programmazione. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Editore
Manning
Anno
2021
ISBN
9781638356226

1 Introducing Rust

This chapter covers
  • Introducing Rust’s features and goals
  • Exposing Rust’s syntax
  • Discussing where to use Rust and when to avoid it
  • Building your first Rust program
  • Explaining how Rust compares to object-oriented and wider languages
Welcome to Rust—the empowering programming language. Once you scratch its surface, you will not only find a programming language with unparalleled speed and safety, but one that is enjoyable enough to use every day.
When you begin to program in Rust, it’s likely that you will want to continue to do so. And this book, Rust in Action, will build your confidence as a Rust programmer. But it will not teach you how to program from the beginning. This book is intended to be read by people who are considering Rust as their next language and for those who enjoy implementing practical working examples. Here is a list of some of the larger examples this book includes:
  • Mandelbrot set renderer
  • A grep clone
  • CPU emulator
  • Generative art
  • A database
  • HTTP, NTP, and hexdump clients
  • LOGO language interpreter
  • Operating system kernel
As you may gather from scanning through that list, reading this book will teach you more than just Rust. It also introduces you to systems programming and low-level programming. As you work through Rust in Action, you’ll learn about the role of an operating system (OS), how a CPU works, how computers keep time, what pointers are, and what a data type is. You will gain an understanding of how the computer’s internal systems interoperate. Learning more than syntax, you will also see why Rust was created and the challenges that it addresses.

1.1 Where is Rust used?

Rust has won the “most loved programming language” award in Stack Overflow’s annual developer survey every year in 2016-2020. Perhaps that’s why large technology leaders such as the following have adopted Rust:
  • Amazon Web Services (AWS) has used Rust since 2017 for its serverless computing offerings, AWS Lambda and AWS Fargate. With that, Rust has gained further inroads. The company has written the Bottlerocket OS and the AWS Nitro System to deliver its Elastic Compute Cloud (EC2) service.1
  • Cloudflare develops many of its services, including its public DNS, serverless computing, and packet inspection offerings with Rust.2
  • Dropbox rebuilt its backend warehouse, which manages exabytes of storage, with Rust.3
  • Google develops parts of Android, such as its Bluetooth module, with Rust. Rust is also used for the crosvm component of Chrome OS and plays an important role in Google’s new operating system, Fuchsia.4
  • Facebook uses Rust to power Facebook’s web, mobile, and API services, as well as parts of HHVM, the HipHop virtual machine used by the Hack programming language.5
  • Microsoft writes components of its Azure platform including a security daemon for its Internet of Things (IoT) service in Rust.6
  • Mozilla uses Rust to enhance the Firefox web browser, which contains 15 million lines of code. Mozilla’s first two Rust-in-Firefox projects, its MP4 metadata parser and text encoder/decoder, led to overall performance and stability improvements.
  • GitHub’s npm, Inc., uses Rust to deliver “upwards of 1.3 billion package downloads per day.”7
  • Oracle developed a container runtime with Rust to overcome problems with the Go reference implementation.8
  • Samsung, via its subsidiary SmartThings, uses Rust in its Hub, which is the firmware backend for its Internet of Things (IoT) service.
Rust is also productive enough for fast-moving startups to deploy it. Here are a few examples:
  • Sourcegraph uses Rust to serve syntax highlighting across all of its languages.9
  • Figma employs Rust in the performance-critical components of its multi-player server.10
  • Parity develops its client to the Ethereum blockchain with Rust.11

1.2 Advocating for Rust at work

What is it like to advocate for Rust at work? After overcoming the initial hurdle, it tends to go well. A 2017 discussion, reprinted below, provides a nice anecdote. One member of Google’s Chrome OS team discusses what it was like to introduce the language to the project:12
indy on Sept 27, 2017 Is Rust an officially sanctioned language at Google?   zaxcellent on Sept 27, 2017  Author here: Rust is not officially sanctioned at Google, but there are  pockets of folks using it here. The trick with using Rust in this  component was convincing my coworkers that no other language was right  for job, which I believe to be the case in this instance.   That being said, there was a ton of work getting Rust to play nice  within the Chrome OS build environment. The Rust folks have been super  helpful in answering my questions th...

Indice dei contenuti