Command-Line Rust

A Project-Based Primer for Writing Rust CLIs

Paperback Engels 2022 1e druk 9781098109431
€ 76,94
Levertijd ± 16 werkdagen
Gratis verzonden

Samenvatting

For several consecutive years, Rust has been voted "most loved programming language" in Stack Overflow's annual developer survey. This open source systems programming language is now used for everything from game engines and operating systems to browser components and virtual reality simulation engines. But Rust is also an incredibly complex language with a notoriously difficult learning curve.

Rather than focusing on the language as a whole, this guide teaches Rust using a single small, complete, focused program in each chapter. Author Ken Youens-Clark shows you how to start, write, and test each of these programs to create a finished product. You'll learn how to handle errors in Rust, read and write files, and use regular expressions, Rust types, structs, and more.

Discover how to:
- Use Rust's standard libraries and data types such as numbers, strings, vectors, structs, Options, and Results to create command-line programs
- Write and test Rust programs and functions
- Read and write files, including stdin, stdout, and stderr
- Document and validate command-line arguments
- Write programs that fail gracefully
- Parse raw and delimited text manually, using regular expressions and Rust crates
- Use and control randomness

Specificaties

ISBN13:9781098109431
Trefwoorden:Programmeren, rust
Taal:Engels
Bindwijze:paperback
Aantal pagina's:350
Uitgever:O'Reilly
Druk:1
Verschijningsdatum:28-1-2022
Hoofdrubriek:IT-management / ICT

Lezersrecensies

Wees de eerste die een lezersrecensie schrijft!

Inhoudsopgave

Preface
What Is Rust (and Why Is Everybody Talkin’ About It)?
Who Should Read This Book
Why You Should Learn Rust
The Coding Challenges
Getting Rust and the Code
Conventions Used in This Book
Using Code Examples
O’Reilly Online Learning
How to Contact Us
Acknowledgments

1. Truth or Consequences
Getting Started with “Hello, world!”
Organizing a Rust Project Directory
Creating and Running a Project with Cargo
Writing and Running Integration Tests
Adding a Project Dependency
Understanding Program Exit Values
Testing the Program Output
Exit Values Make Programs Composable
Summary

2. Test for Echo
How echo Works
Getting Started
Accessing the Command-Line Arguments
Adding clap as a Dependency
Parsing Command-Line Arguments Using clap
Creating the Program Output
Writing Integration Tests
Creating the Test Output Files
Comparing Program Output
Using the Result Type
Summary

3. On the Catwalk
How cat Works
Getting Started
Starting with Tests
Creating a Library Crate
Defining the Parameters
Iterating Through the File Arguments
Opening a File or STDIN
Using the Test Suite
Solution
Reading the Lines in a File
Printing Line Numbers
Going Further
Summary

4. Head Aches
How head Works
Getting Started
Writing a Unit Test to Parse a String into a Number
Converting Strings into Errors
Defining the Arguments
Processing the Input Files
Reading Bytes Versus Characters
Solution
Afgekapt op 60 regels

Managementboek Top 100

€ 76,94
Levertijd ongeveer 16 werkdagen
Gratis verzonden

Rubrieken

Producten

    Auteurs

      Trefwoorden

        Artikelen

          Command-Line Rust