Command-Line Rust

┬╖ "O'Reilly Media, Inc."
рдЗ-рдкреБрд╕реНрддрдХ
402
рдкреГрд╖реНрдард╣рд░реВ
рдпреЛрдЧреНрдп

рдпреЛ рдЗ-рдкреБрд╕реНрддрдХрдХрд╛ рдмрд╛рд░реЗрдорд╛

Updated in 2024: A new version has been released that simplifies the programs used in the book, based on changes in the Rust language and crates since original publication. The code has been updated to reflect version 4 of the clap crate.



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

рд▓реЗрдЦрдХрдХреЛ рдмрд╛рд░реЗрдорд╛

Ken Youens-Clark is the author of Tiny Python Projects (Manning, 2020) and Mastering Python for Bioinformatics (OтАЩReilly, 2021). Ken is a senior-level developer with 25 years of experience writing and supporting code written in many languages who has spent several years teaching beginning coding at the university level, and is deeply committed to creating useful teaching resources for people who wish to learn coding.

рдпреЛ рдЗ-рдкреБрд╕реНрддрдХрдХреЛ рдореВрд▓реНрдпрд╛рдЩреНрдХрди рдЧрд░реНрдиреБрд╣реЛрд╕реН

рд╣рд╛рдореАрд▓рд╛рдИ рдЖрдлреНрдиреЛ рдзрд╛рд░рдгрд╛ рдмрддрд╛рдЙрдиреБрд╣реЛрд╕реНред

рдЬрд╛рдирдХрд╛рд░реА рдкрдвреНрджреИ

рд╕реНрдорд╛рд░реНрдЯрдлреЛрди рддрдерд╛ рдЯреНрдпрд╛рдмрд▓реЗрдЯрд╣рд░реВ
Android рд░ iPad/iPhone рдХрд╛ рд▓рд╛рдЧрд┐┬аGoogle Play рдХрд┐рддрд╛рдм рдПрдк рдХреЛ рдЗрдиреНрд╕реНрдЯрд▓ рдЧрд░реНрдиреБрд╣реЛрд╕реНред рдпреЛ рддрдкрд╛рдИрдВрдХреЛ рдЦрд╛рддрд╛рд╕реЕрдВрдЧ рд╕реНрд╡рддрдГ рд╕рд┐рдВрдХ рд╣реБрдиреНрдЫ рд░ рддрдкрд╛рдИрдВ рдЕрдирд▓рд╛рдЗрди рд╡рд╛ рдЕрдлрд▓рд╛рдЗрди рдЬрд╣рд╛рдБ рднрдП рдкрдирд┐┬ардЕрдзреНрдпрдпрди рдЧрд░реНрди рджрд┐рдиреНрдЫред
рд▓реНрдпрд╛рдкрдЯрдк рддрдерд╛ рдХрдореНрдкреНрдпреБрдЯрд░рд╣рд░реВ
рддрдкрд╛рдИрдВ Google Play рдорд╛ рдЦрд░рд┐рдж рдЧрд░рд┐рдПрдХреЛ рдЕрдбрд┐рдпреЛрдмреБрдХ рдЖрдлреНрдиреЛ рдХрдореНрдкреНрдпреБрдЯрд░рдХреЛ рд╡реЗрдм рдмреНрд░рд╛рдЙрдЬрд░ рдкреНрд░рдпреЛрдЧ рдЧрд░реЗрд░ рд╕реБрдиреНрди рд╕рдХреНрдиреБрд╣реБрдиреНрдЫред
eReaders рд░ рдЕрдиреНрдп рдЙрдкрдХрд░рдгрд╣рд░реВ
Kobo eReaders рдЬрд╕реНрддрд╛ e-ink рдбрд┐рднрд╛рдЗрд╕рд╣рд░реВрдорд╛ рдлрд╛рдЗрд▓ рдкрдвреНрди рддрдкрд╛рдИрдВрд▓реЗ рдлрд╛рдЗрд▓ рдбрд╛рдЙрдирд▓реЛрдб рдЧрд░реЗрд░ рдЙрдХреНрдд рдлрд╛рдЗрд▓ рдЖрдлреНрдиреЛ рдбрд┐рднрд╛рдЗрд╕рдорд╛ рдЯреНрд░рд╛рдиреНрд╕реНрдлрд░ рдЧрд░реНрдиреБ рдкрд░реНрдиреЗ рд╣реБрдиреНрдЫред рддреА рдлрд╛рдЗрд▓рд╣рд░реВ рдкрдвреНрди рдорд┐рд▓реНрдиреЗ рдЗрдмреБрдХ рд░рд┐рдбрд░рд╣рд░реВрдорд╛ рддреА рдлрд╛рдЗрд▓рд╣рд░реВ рдЯреНрд░рд╛рдиреНрд╕реНрдлрд░ рдЧрд░реНрдиреЗрд╕рдореНрдмрдиреНрдзреА рд╡рд┐рд╕реНрддреГрдд рдирд┐рд░реНрджреЗрд╢рдирд╣рд░реВ рдкреНрд░рд╛рдкреНрдд рдЧрд░реНрди рдорджреНрджрдд рдХреЗрдиреНрджреНрд░ рдорд╛ рдЬрд╛рдиреБрд╣реЛрд╕реНред