From 8c8ef1e1a2bfc21696dacde0c444c18c484b3298 Mon Sep 17 00:00:00 2001 From: chuksgpfr Date: Sun, 2 Mar 2025 21:07:31 +0100 Subject: [PATCH] changed rand deprecated function --- .../listing-02-02/Cargo.toml | 2 +- .../listing-02-03/Cargo.toml | 2 +- .../listing-02-03/src/main.rs | 2 +- .../listing-02-04/Cargo.toml | 2 +- .../listing-02-04/src/main.rs | 2 +- .../listing-02-05/Cargo.toml | 2 +- .../listing-02-05/src/main.rs | 2 +- .../listing-02-06/Cargo.toml | 2 +- .../listing-02-06/src/main.rs | 2 +- .../Cargo.toml | 2 +- .../src/main.rs | 2 +- .../no-listing-04-looping/Cargo.toml | 2 +- .../no-listing-04-looping/src/main.rs | 2 +- .../no-listing-05-quitting/Cargo.toml | 2 +- .../no-listing-05-quitting/src/main.rs | 2 +- .../listing-07-18/Cargo.toml | 2 +- .../listing-07-18/src/main.rs | 2 +- .../no-listing-01-use-std-unnested/Cargo.toml | 2 +- .../no-listing-01-use-std-unnested/src/main.rs | 2 +- .../ch09-error-handling/listing-09-13/Cargo.toml | 2 +- .../ch09-error-handling/listing-09-13/src/main.rs | 2 +- .../no-listing-09-guess-out-of-range/Cargo.toml | 2 +- .../no-listing-09-guess-out-of-range/src/main.rs | 2 +- .../add/add_one/Cargo.toml | 2 +- .../output-only-03-use-rand/add/add_one/Cargo.toml | 2 +- nostarch/appendix.md | 2 +- nostarch/appendix_c.md | 2 +- nostarch/chapter02.md | 12 ++++++------ nostarch/chapter07.md | 6 +++--- nostarch/chapter14.md | 2 +- src/appendix-03-derivable-traits.md | 2 +- src/ch02-00-guessing-game-tutorial.md | 6 +++--- ...bringing-paths-into-scope-with-the-use-keyword.md | 2 +- 33 files changed, 42 insertions(+), 42 deletions(-) diff --git a/listings/ch02-guessing-game-tutorial/listing-02-02/Cargo.toml b/listings/ch02-guessing-game-tutorial/listing-02-02/Cargo.toml index eba27a883c..a76814f921 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-02/Cargo.toml +++ b/listings/ch02-guessing-game-tutorial/listing-02-02/Cargo.toml @@ -6,4 +6,4 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch02-guessing-game-tutorial/listing-02-03/Cargo.toml b/listings/ch02-guessing-game-tutorial/listing-02-03/Cargo.toml index eba27a883c..a76814f921 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-03/Cargo.toml +++ b/listings/ch02-guessing-game-tutorial/listing-02-03/Cargo.toml @@ -6,4 +6,4 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch02-guessing-game-tutorial/listing-02-03/src/main.rs b/listings/ch02-guessing-game-tutorial/listing-02-03/src/main.rs index 1ba2d4d41f..db062a140c 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-03/src/main.rs +++ b/listings/ch02-guessing-game-tutorial/listing-02-03/src/main.rs @@ -8,7 +8,7 @@ fn main() { println!("Guess the number!"); // ANCHOR: ch07-04 - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); // ANCHOR_END: ch07-04 println!("The secret number is: {secret_number}"); diff --git a/listings/ch02-guessing-game-tutorial/listing-02-04/Cargo.toml b/listings/ch02-guessing-game-tutorial/listing-02-04/Cargo.toml index eba27a883c..a76814f921 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-04/Cargo.toml +++ b/listings/ch02-guessing-game-tutorial/listing-02-04/Cargo.toml @@ -6,4 +6,4 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch02-guessing-game-tutorial/listing-02-04/src/main.rs b/listings/ch02-guessing-game-tutorial/listing-02-04/src/main.rs index 6e58a76455..3fbc5fd810 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-04/src/main.rs +++ b/listings/ch02-guessing-game-tutorial/listing-02-04/src/main.rs @@ -8,7 +8,7 @@ fn main() { // ANCHOR_END: here println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); println!("The secret number is: {secret_number}"); diff --git a/listings/ch02-guessing-game-tutorial/listing-02-05/Cargo.toml b/listings/ch02-guessing-game-tutorial/listing-02-05/Cargo.toml index eba27a883c..a76814f921 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-05/Cargo.toml +++ b/listings/ch02-guessing-game-tutorial/listing-02-05/Cargo.toml @@ -6,4 +6,4 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch02-guessing-game-tutorial/listing-02-05/src/main.rs b/listings/ch02-guessing-game-tutorial/listing-02-05/src/main.rs index 12f497e181..1162281b09 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-05/src/main.rs +++ b/listings/ch02-guessing-game-tutorial/listing-02-05/src/main.rs @@ -5,7 +5,7 @@ use std::io; fn main() { println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); println!("The secret number is: {secret_number}"); diff --git a/listings/ch02-guessing-game-tutorial/listing-02-06/Cargo.toml b/listings/ch02-guessing-game-tutorial/listing-02-06/Cargo.toml index eba27a883c..a76814f921 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-06/Cargo.toml +++ b/listings/ch02-guessing-game-tutorial/listing-02-06/Cargo.toml @@ -6,4 +6,4 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch02-guessing-game-tutorial/listing-02-06/src/main.rs b/listings/ch02-guessing-game-tutorial/listing-02-06/src/main.rs index 7fcbb99fbf..384ebb8891 100644 --- a/listings/ch02-guessing-game-tutorial/listing-02-06/src/main.rs +++ b/listings/ch02-guessing-game-tutorial/listing-02-06/src/main.rs @@ -5,7 +5,7 @@ use std::io; fn main() { println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); loop { println!("Please input your guess."); diff --git a/listings/ch02-guessing-game-tutorial/no-listing-03-convert-string-to-number/Cargo.toml b/listings/ch02-guessing-game-tutorial/no-listing-03-convert-string-to-number/Cargo.toml index eba27a883c..a76814f921 100644 --- a/listings/ch02-guessing-game-tutorial/no-listing-03-convert-string-to-number/Cargo.toml +++ b/listings/ch02-guessing-game-tutorial/no-listing-03-convert-string-to-number/Cargo.toml @@ -6,4 +6,4 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch02-guessing-game-tutorial/no-listing-03-convert-string-to-number/src/main.rs b/listings/ch02-guessing-game-tutorial/no-listing-03-convert-string-to-number/src/main.rs index 7f076c592d..37dd3c65c6 100644 --- a/listings/ch02-guessing-game-tutorial/no-listing-03-convert-string-to-number/src/main.rs +++ b/listings/ch02-guessing-game-tutorial/no-listing-03-convert-string-to-number/src/main.rs @@ -5,7 +5,7 @@ use std::io; fn main() { println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); println!("The secret number is: {secret_number}"); diff --git a/listings/ch02-guessing-game-tutorial/no-listing-04-looping/Cargo.toml b/listings/ch02-guessing-game-tutorial/no-listing-04-looping/Cargo.toml index eba27a883c..a76814f921 100644 --- a/listings/ch02-guessing-game-tutorial/no-listing-04-looping/Cargo.toml +++ b/listings/ch02-guessing-game-tutorial/no-listing-04-looping/Cargo.toml @@ -6,4 +6,4 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch02-guessing-game-tutorial/no-listing-04-looping/src/main.rs b/listings/ch02-guessing-game-tutorial/no-listing-04-looping/src/main.rs index f97d1c58ce..5b851ce609 100644 --- a/listings/ch02-guessing-game-tutorial/no-listing-04-looping/src/main.rs +++ b/listings/ch02-guessing-game-tutorial/no-listing-04-looping/src/main.rs @@ -5,7 +5,7 @@ use std::io; fn main() { println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); // ANCHOR: here // --snip-- diff --git a/listings/ch02-guessing-game-tutorial/no-listing-05-quitting/Cargo.toml b/listings/ch02-guessing-game-tutorial/no-listing-05-quitting/Cargo.toml index eba27a883c..a76814f921 100644 --- a/listings/ch02-guessing-game-tutorial/no-listing-05-quitting/Cargo.toml +++ b/listings/ch02-guessing-game-tutorial/no-listing-05-quitting/Cargo.toml @@ -6,4 +6,4 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch02-guessing-game-tutorial/no-listing-05-quitting/src/main.rs b/listings/ch02-guessing-game-tutorial/no-listing-05-quitting/src/main.rs index def0a0e7ee..0e69e8291c 100644 --- a/listings/ch02-guessing-game-tutorial/no-listing-05-quitting/src/main.rs +++ b/listings/ch02-guessing-game-tutorial/no-listing-05-quitting/src/main.rs @@ -5,7 +5,7 @@ use std::io; fn main() { println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); println!("The secret number is: {secret_number}"); diff --git a/listings/ch07-managing-growing-projects/listing-07-18/Cargo.toml b/listings/ch07-managing-growing-projects/listing-07-18/Cargo.toml index 9f9c4acb96..123b7686fc 100644 --- a/listings/ch07-managing-growing-projects/listing-07-18/Cargo.toml +++ b/listings/ch07-managing-growing-projects/listing-07-18/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2024" [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch07-managing-growing-projects/listing-07-18/src/main.rs b/listings/ch07-managing-growing-projects/listing-07-18/src/main.rs index 2f69412a4c..34b0567625 100644 --- a/listings/ch07-managing-growing-projects/listing-07-18/src/main.rs +++ b/listings/ch07-managing-growing-projects/listing-07-18/src/main.rs @@ -8,7 +8,7 @@ use std::{cmp::Ordering, io}; fn main() { println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); println!("The secret number is: {secret_number}"); diff --git a/listings/ch07-managing-growing-projects/no-listing-01-use-std-unnested/Cargo.toml b/listings/ch07-managing-growing-projects/no-listing-01-use-std-unnested/Cargo.toml index eba27a883c..a76814f921 100644 --- a/listings/ch07-managing-growing-projects/no-listing-01-use-std-unnested/Cargo.toml +++ b/listings/ch07-managing-growing-projects/no-listing-01-use-std-unnested/Cargo.toml @@ -6,4 +6,4 @@ edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch07-managing-growing-projects/no-listing-01-use-std-unnested/src/main.rs b/listings/ch07-managing-growing-projects/no-listing-01-use-std-unnested/src/main.rs index 3a02c99633..7a83325ba8 100644 --- a/listings/ch07-managing-growing-projects/no-listing-01-use-std-unnested/src/main.rs +++ b/listings/ch07-managing-growing-projects/no-listing-01-use-std-unnested/src/main.rs @@ -9,7 +9,7 @@ use std::io; fn main() { println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); println!("The secret number is: {secret_number}"); diff --git a/listings/ch09-error-handling/listing-09-13/Cargo.toml b/listings/ch09-error-handling/listing-09-13/Cargo.toml index 9f9c4acb96..123b7686fc 100644 --- a/listings/ch09-error-handling/listing-09-13/Cargo.toml +++ b/listings/ch09-error-handling/listing-09-13/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2024" [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch09-error-handling/listing-09-13/src/main.rs b/listings/ch09-error-handling/listing-09-13/src/main.rs index cda389303b..dab97744f1 100644 --- a/listings/ch09-error-handling/listing-09-13/src/main.rs +++ b/listings/ch09-error-handling/listing-09-13/src/main.rs @@ -6,7 +6,7 @@ use std::io; fn main() { println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); loop { println!("Please input your guess."); diff --git a/listings/ch09-error-handling/no-listing-09-guess-out-of-range/Cargo.toml b/listings/ch09-error-handling/no-listing-09-guess-out-of-range/Cargo.toml index 9f9c4acb96..123b7686fc 100644 --- a/listings/ch09-error-handling/no-listing-09-guess-out-of-range/Cargo.toml +++ b/listings/ch09-error-handling/no-listing-09-guess-out-of-range/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2024" [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch09-error-handling/no-listing-09-guess-out-of-range/src/main.rs b/listings/ch09-error-handling/no-listing-09-guess-out-of-range/src/main.rs index fc22cbc5ef..69d4260868 100644 --- a/listings/ch09-error-handling/no-listing-09-guess-out-of-range/src/main.rs +++ b/listings/ch09-error-handling/no-listing-09-guess-out-of-range/src/main.rs @@ -5,7 +5,7 @@ use std::io; fn main() { println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); // ANCHOR: here loop { diff --git a/listings/ch14-more-about-cargo/no-listing-03-workspace-with-external-dependency/add/add_one/Cargo.toml b/listings/ch14-more-about-cargo/no-listing-03-workspace-with-external-dependency/add/add_one/Cargo.toml index d399d96e7b..f5cc5fe7e3 100644 --- a/listings/ch14-more-about-cargo/no-listing-03-workspace-with-external-dependency/add/add_one/Cargo.toml +++ b/listings/ch14-more-about-cargo/no-listing-03-workspace-with-external-dependency/add/add_one/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2024" [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/listings/ch14-more-about-cargo/output-only-03-use-rand/add/add_one/Cargo.toml b/listings/ch14-more-about-cargo/output-only-03-use-rand/add/add_one/Cargo.toml index d399d96e7b..f5cc5fe7e3 100644 --- a/listings/ch14-more-about-cargo/output-only-03-use-rand/add/add_one/Cargo.toml +++ b/listings/ch14-more-about-cargo/output-only-03-use-rand/add/add_one/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2024" [dependencies] -rand = "0.8.5" +rand = "0.9.0" diff --git a/nostarch/appendix.md b/nostarch/appendix.md index 98432a1dac..a2a089ea1d 100644 --- a/nostarch/appendix.md +++ b/nostarch/appendix.md @@ -466,7 +466,7 @@ value in each field in the order in which the fields appear in the struct definition. When derived on enums, variants of the enum declared earlier in the enum definition are considered less than the variants listed later. -The `PartialOrd` trait is required, for example, for the `gen_range` method +The `PartialOrd` trait is required, for example, for the `random_range` method from the `rand` crate that generates a random value in the range specified by a range expression. diff --git a/nostarch/appendix_c.md b/nostarch/appendix_c.md index 53131eb5fa..f456d0b645 100644 --- a/nostarch/appendix_c.md +++ b/nostarch/appendix_c.md @@ -100,7 +100,7 @@ value in each field in the order in which the fields appear in the struct definition. When derived on enums, variants of the enum declared earlier in the enum definition are considered less than the variants listed later. -The `PartialOrd` trait is required, for example, for the `gen_range` method +The `PartialOrd` trait is required, for example, for the `random_range` method from the `rand` crate that generates a random value in the range specified by a range expression. diff --git a/nostarch/chapter02.md b/nostarch/chapter02.md index b01770dc5c..fd07eeb854 100644 --- a/nostarch/chapter02.md +++ b/nostarch/chapter02.md @@ -373,7 +373,7 @@ Filename: Cargo.toml ``` [dependencies] -rand = "0.8.5" +rand = "0.9.0" ``` In the *Cargo.toml* file, everything that follows a header is part of that @@ -522,7 +522,7 @@ use std::io; fn main() { println!("Guess the number!"); - 2 let secret_number = rand::thread_rng().gen_range(1..=100); + 2 let secret_number = rand::rng().random_range(1..=100); 3 println!("The secret number is: {secret_number}"); @@ -545,12 +545,12 @@ that random number generators implement, and this trait must be in scope for us to use those methods. Chapter 10 will cover traits in detail. Next, we’re adding two lines in the middle. In the first line [2], we call the -`rand::thread_rng` function that gives us the particular random number +`rand::rng` function that gives us the particular random number generator we’re going to use: one that is local to the current thread of -execution and is seeded by the operating system. Then we call the `gen_range` +execution and is seeded by the operating system. Then we call the `random_range` method on the random number generator. This method is defined by the `Rng` trait that we brought into scope with the `use rand::Rng;` statement. The -`gen_range` method takes a range expression as an argument and generates a +`random_range` method takes a range expression as an argument and generates a random number in the range. The kind of range expression we’re using here takes the form `start..=end` and is inclusive on the lower and upper bounds, so we need to specify `1..=100` to request a number between 1 and 100. @@ -960,7 +960,7 @@ use std::io; fn main() { println!("Guess the number!"); - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); loop { println!("Please input your guess."); diff --git a/nostarch/chapter07.md b/nostarch/chapter07.md index 0a7a407935..f1ded067da 100644 --- a/nostarch/chapter07.md +++ b/nostarch/chapter07.md @@ -1029,7 +1029,7 @@ added this line to *Cargo.toml*: Filename: Cargo.toml ``` -rand = "0.8.5" +rand = "0.9.0" ``` Adding `rand` as a dependency in *Cargo.toml* tells Cargo to download the @@ -1040,13 +1040,13 @@ Then, to bring `rand` definitions into the scope of our package, we added a `use` line starting with the name of the crate, `rand`, and listed the items we wanted to bring into scope. Recall that in the “Generating a Random Number” section in Chapter 2, we brought the `Rng` trait -into scope and called the `rand::thread_rng` function: +into scope and called the `rand::rng` function: ``` use rand::Rng; fn main() { - let secret_number = rand::thread_rng().gen_range(1..=100); + let secret_number = rand::rng().random_range(1..=100); } ``` diff --git a/nostarch/chapter14.md b/nostarch/chapter14.md index f5f2be7196..0ae23373f0 100644 --- a/nostarch/chapter14.md +++ b/nostarch/chapter14.md @@ -796,7 +796,7 @@ Filename: add_one/Cargo.toml ``` [dependencies] -rand = "0.8.5" +rand = "0.9.0" ``` We can now add `use rand;` to the *add_one/src/lib.rs* file, and building the diff --git a/src/appendix-03-derivable-traits.md b/src/appendix-03-derivable-traits.md index 5cffa46cf8..3967d5f23c 100644 --- a/src/appendix-03-derivable-traits.md +++ b/src/appendix-03-derivable-traits.md @@ -92,7 +92,7 @@ value in each field in the order in which the fields appear in the struct definition. When derived on enums, variants of the enum declared earlier in the enum definition are considered less than the variants listed later. -The `PartialOrd` trait is required, for example, for the `gen_range` method +The `PartialOrd` trait is required, for example, for the `random_range` method from the `rand` crate that generates a random value in the range specified by a range expression. diff --git a/src/ch02-00-guessing-game-tutorial.md b/src/ch02-00-guessing-game-tutorial.md index be9d6078c1..c335994d4e 100644 --- a/src/ch02-00-guessing-game-tutorial.md +++ b/src/ch02-00-guessing-game-tutorial.md @@ -525,12 +525,12 @@ random number generators implement, and this trait must be in scope for us to use those methods. Chapter 10 will cover traits in detail. Next, we’re adding two lines in the middle. In the first line, we call the -`rand::thread_rng` function that gives us the particular random number +`rand::rng` function that gives us the particular random number generator we’re going to use: one that is local to the current thread of -execution and is seeded by the operating system. Then we call the `gen_range` +execution and is seeded by the operating system. Then we call the `random_range` method on the random number generator. This method is defined by the `Rng` trait that we brought into scope with the `use rand::Rng;` statement. The -`gen_range` method takes a range expression as an argument and generates a +`random_range` method takes a range expression as an argument and generates a random number in the range. The kind of range expression we’re using here takes the form `start..=end` and is inclusive on the lower and upper bounds, so we need to specify `1..=100` to request a number between 1 and 100. diff --git a/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md b/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md index efff28e580..88c83609d1 100644 --- a/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md +++ b/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md @@ -194,7 +194,7 @@ Then, to bring `rand` definitions into the scope of our package, we added a `use` line starting with the name of the crate, `rand`, and listed the items we wanted to bring into scope. Recall that in [“Generating a Random Number”][rand] in Chapter 2, we brought the `Rng` trait into -scope and called the `rand::thread_rng` function: +scope and called the `rand::rng` function: ```rust,ignore {{#rustdoc_include ../listings/ch02-guessing-game-tutorial/listing-02-03/src/main.rs:ch07-04}}