WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 260e55d

Browse files
Mohit NandaniyaMohit Nandaniya
authored andcommitted
feat(ch02): Update guessing game dependencies to rand 0.9.2 and code
1 parent 8c0eacd commit 260e55d

File tree

20 files changed

+327
-648
lines changed

20 files changed

+327
-648
lines changed

Cargo.lock

Lines changed: 245 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
members = ["packages/tools"]
2+
members = ["listings/ch02-guessing-game-tutorial/listing-02-02", "listings/ch02-guessing-game-tutorial/listing-02-03", "listings/ch02-guessing-game-tutorial/listing-02-04", "listings/ch02-guessing-game-tutorial/listing-02-05", "listings/ch02-guessing-game-tutorial/listing-02-06","packages/tools"]
33
default-members = ["packages/tools"]
44
resolver = "2"
55
exclude = [

ci/dictionary.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ Workspaces
639639
wouldn
640640
writeln
641641
WriteMessage
642+
wasip2
643+
wit-bindgen
642644
xcode
643645
xpression
644646
yyyy

listings/ch02-guessing-game-tutorial/listing-02-02/Cargo.lock

Lines changed: 0 additions & 140 deletions
This file was deleted.
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[package]
2-
name = "guessing_game"
2+
name = "listing-02-02"
33
version = "0.1.0"
44
edition = "2024"
55

6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7-
86
[dependencies]
9-
rand = "0.8.5"
7+
rand = "0.9.2"
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
use std::io;
2-
31
fn main() {
4-
println!("Guess the number!");
5-
6-
println!("Please input your guess.");
7-
8-
let mut guess = String::new();
9-
10-
io::stdin()
11-
.read_line(&mut guess)
12-
.expect("Failed to read line");
13-
14-
println!("You guessed: {guess}");
2+
println!("Hello, world!");
153
}

listings/ch02-guessing-game-tutorial/listing-02-03/Cargo.lock

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[package]
2-
name = "guessing_game"
2+
name = "listing-02-03"
33
version = "0.1.0"
44
edition = "2024"
55

6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7-
86
[dependencies]
9-
rand = "0.8.5"
7+
rand = "0.9.2"

listings/ch02-guessing-game-tutorial/listing-02-03/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
use std::io;
33

44
// ANCHOR: ch07-04
5-
use rand::Rng;
5+
use rand::random_range;
66

77
fn main() {
88
// ANCHOR_END: ch07-04
99
println!("Guess the number!");
1010

1111
// ANCHOR: ch07-04
12-
let secret_number = rand::thread_rng().gen_range(1..=100);
12+
let secret_number = random_range(1..=100);
1313
// ANCHOR_END: ch07-04
1414

1515
println!("The secret number is: {secret_number}");

listings/ch02-guessing-game-tutorial/listing-02-04/Cargo.lock

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)