In this chapter, we will cover the following recipes:
- Concatenating strings
- Using the format! macro
- Providing a default implementation
- Using the constructor pattern
- Using the builder pattern
- Parallelism through simple threads
- Generating random numbers
- Querying with regexes
- Accessing the command line
- Interacting with environment variables
- Reading from stdin
- Accepting a variable number of arguments
Introduction
There are some code snippets and patterns of thought that prove time and again to be the bread and butter of a certain programming language. We will start this book by looking at a handful of such techniques in Rust. They are so quintessential for elegant and flexible code that you will use at least some of them ...