Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ch17 Rustのオブジェクト指向プログラミング機能の和訳を最新版に更新 #265

Open
wants to merge 41 commits into
base: master-ja
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e685c96
ch02 数当てゲームのプログラミングの和訳を最新版に更新
shinmili May 26, 2024
db3a649
リンク漏れ修正
shinmili Nov 28, 2024
24f5af0
コメントの位置修正
shinmili Dec 26, 2024
cf8947f
ch03 一般的なプログラミングの概念の和訳を最新版に更新
shinmili May 26, 2024
42a63a5
リンク漏れ修正
shinmili Nov 28, 2024
e0d2a48
誤字修正
shinmili Jan 31, 2025
42cf09e
ch04 所有権を理解するの和訳を最新版に更新
shinmili May 26, 2024
138f7fc
コメント閉じ忘れ修正
shinmili Nov 28, 2024
f5f69e9
コードブロックの訳し漏れ修正
shinmili Nov 28, 2024
40d8fd5
ch05 構造体を使用して関係のあるデータを構造化するの和訳を最新版に更新
shinmili May 26, 2024
70c7a13
ch06 Enumとパターンマッチングの和訳を最新版に更新
shinmili May 26, 2024
2f70d34
ch07 肥大化していくプロジェクトをパッケージ、クレート、モジュールを利用して管理するの和訳を最新版に更新
shinmili May 26, 2024
0c0c9d5
消し忘れた段落を削除
shinmili Nov 29, 2024
9eb0aa4
読点の修正
shinmili Nov 29, 2024
1139c13
ch08 一般的なコレクションの和訳を最新版に更新
shinmili May 26, 2024
32a5e00
誤字修正
shinmili Nov 30, 2024
cbd1f9c
消し忘れた段落を削除
shinmili Nov 30, 2024
777e045
コメントの閉じ方の誤りを修正
shinmili Nov 30, 2024
6da5374
修正漏れを修正
shinmili Nov 30, 2024
75aeb75
doc.rust-lang.org 内でのみ機能する相対リンクを修正
shinmili Nov 30, 2024
93e7c99
ch09 エラー処理の和訳を最新版に更新
shinmili May 26, 2024
ee5f863
不要な記号の削除
shinmili Nov 30, 2024
1e6ccf0
消し忘れた段落を削除
shinmili Nov 30, 2024
4e664a9
コメントの位置修正
shinmili Dec 27, 2024
4e3d9ea
ch10 ジェネリック型、トレイト、ライフタイムの和訳を最新版に更新
shinmili May 26, 2024
439eeec
消し忘れた段落を削除
shinmili Nov 30, 2024
fb60cce
ch11 自動テストを書くの和訳を最新版に更新
shinmili May 26, 2024
91b9e1a
見出しレベル誤りを修正
shinmili Dec 1, 2024
059af4e
消し忘れた段落を削除
shinmili Dec 1, 2024
5464a6e
余計な空行を削除
shinmili Dec 27, 2024
06f787f
訳し漏れの翻訳を追加
shinmili Jan 31, 2025
fff91f0
誤字修正
shinmili Jan 31, 2025
57c5588
ch12 入出力プロジェクト: コマンドラインプログラムを構築するの和訳を最新版に更新
shinmili May 26, 2024
e042c99
ch13 関数型言語の機能: イテレータとクロージャの和訳を最新版に更新
shinmili May 26, 2024
4543380
見出しレベル誤りを修正
shinmili Dec 1, 2024
57b18f1
訳し忘れを修正
shinmili Dec 1, 2024
db47fd2
ch14 CargoとCrates.ioについてより詳しくの和訳を最新版に更新
shinmili May 26, 2024
e3bf9f9
ch15 スマートポインタの和訳を最新版に更新
shinmili May 26, 2024
e49e340
消し忘れた段落を削除
shinmili Dec 7, 2024
64432c2
ch16 恐れるな!並行性の和訳を最新版に更新
shinmili May 26, 2024
bd648eb
ch17 Rustのオブジェクト指向プログラミング機能の和訳を最新版に更新
shinmili May 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 16 additions & 0 deletions dot/trpl15-04.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
digraph {
node[shape=record];
rankdir=LR;

l1[label="{<data> 5| <next>}"];
l2[label="{<data> 10| <next>}"];

{node[shape=point height=0] invisible_start invisible_end}

a -> l1:n;
b -> l2:n;
invisible_start:n -> l1[arrowtail=none];
invisible_start:s -> invisible_end:s[dir=none];
l1:next:c -> l2:data;
l2:next:c -> invisible_end:n[arrowhead=none];
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn main() {
// ANCHOR_END: expect

// ANCHOR: print_guess
println!("You guessed: {}", guess); // 次のように予想しました: {}
println!("You guessed: {guess}"); // 次のように予想しました: {guess}
// ANCHOR_END: print_guess
}
// ANCHOR: all
40 changes: 16 additions & 24 deletions listings/ch02-guessing-game-tutorial/listing-02-02/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.8.3"
rand = "0.8.5"
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ fn main() {
.read_line(&mut guess)
.expect("Failed to read line");

println!("You guessed: {}", guess);
println!("You guessed: {guess}");
}
16 changes: 4 additions & 12 deletions listings/ch02-guessing-game-tutorial/listing-02-03/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.8.3"
rand = "0.8.5"
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ fn main() {
println!("Guess the number!");

// ANCHOR: ch07-04
let secret_number = rand::thread_rng().gen_range(1..101);
let secret_number = rand::thread_rng().gen_range(1..=100);
// ANCHOR_END: ch07-04

println!("The secret number is: {}", secret_number); //秘密の数字は次の通り: {}
println!("The secret number is: {secret_number}"); //秘密の数字は次の通り: {secret_number}

println!("Please input your guess.");

Expand All @@ -21,7 +21,7 @@ fn main() {
.read_line(&mut guess)
.expect("Failed to read line");

println!("You guessed: {}", guess);
println!("You guessed: {guess}");
// ANCHOR: ch07-04
}
// ANCHOR_END: ch07-04
Expand Down
16 changes: 4 additions & 12 deletions listings/ch02-guessing-game-tutorial/listing-02-04/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.8.3"
rand = "0.8.5"
40 changes: 10 additions & 30 deletions listings/ch02-guessing-game-tutorial/listing-02-04/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,22 @@ $ cargo build
Compiling ppv-lite86 v0.2.10
Compiling rand_core v0.6.2
Compiling rand_chacha v0.3.0
Compiling rand v0.8.3
Compiling rand v0.8.5
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
error[E0308]: mismatched types (型が合いません)
--> src/main.rs:22:21
|
22 | match guess.cmp(&secret_number) {
| ^^^^^^^^^^^^^^ expected struct `String`, found integer
| (構造体`std::string::String`を予期したけど、整数型変数が見つかりました)
| --- ^^^^^^^^^^^^^^ expected `&String`, found `&{integer}`
| | (`&String`を予期したけど、`&{integer}`が見つかりました)
| |
| arguments to this method are incorrect
| (このメソッドへの引数が正しくありません)
|
= note: expected reference `&String`
found reference `&{integer}`
note: method defined here
--> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/cmp.rs:814:8

error[E0283]: type annotations needed for `{integer}`
--> src/main.rs:8:44
|
8 | let secret_number = rand::thread_rng().gen_range(1..101);
| ------------- ^^^^^^^^^ cannot infer type for type `{integer}`
| |
| consider giving `secret_number` a type
|
= note: multiple `impl`s satisfying `{integer}: SampleUniform` found in the `rand` crate:
- impl SampleUniform for i128;
- impl SampleUniform for i16;
- impl SampleUniform for i32;
- impl SampleUniform for i64;
and 8 more
note: required by a bound in `gen_range`
--> /Users/carolnichols/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.3/src/rng.rs:129:12
|
129 | T: SampleUniform,
| ^^^^^^^^^^^^^ required by this bound in `gen_range`
help: consider specifying the type arguments in the function call
|
8 | let secret_number = rand::thread_rng().gen_range::<T, R>(1..101);
| ++++++++

Some errors have detailed explanations: E0283, E0308.
For more information about an error, try `rustc --explain E0283`.
error: could not compile `guessing_game` due to 2 previous errors (先の2つのエラーのため、`guessing_game`をコンパイルできませんでした)
For more information about this error, try `rustc --explain E0308`.
error: could not compile `guessing_game` (bin "guessing_game") due to 1 previous error (先の1つのエラーのため、`guessing_game` (bin "guessing_game") をコンパイルできませんでした)
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ fn main() {
// ANCHOR_END: here
println!("Guess the number!");

let secret_number = rand::thread_rng().gen_range(1..101);
let secret_number = rand::thread_rng().gen_range(1..=100);

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

println!("Please input your guess.");

Expand All @@ -21,7 +21,7 @@ fn main() {
.expect("Failed to read line");
// ANCHOR: here

println!("You guessed: {}", guess);
println!("You guessed: {guess}");

match guess.cmp(&secret_number) {
Ordering::Less => println!("Too small!"), //小さすぎ!
Expand Down
16 changes: 4 additions & 12 deletions listings/ch02-guessing-game-tutorial/listing-02-05/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.8.3"
rand = "0.8.5"
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::io;
fn main() {
println!("Guess the number!");

let secret_number = rand::thread_rng().gen_range(1..101);
let secret_number = rand::thread_rng().gen_range(1..=100);

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

loop {
println!("Please input your guess.");
Expand All @@ -28,7 +28,7 @@ fn main() {
};
// ANCHOR_END: ch19

println!("You guessed: {}", guess);
println!("You guessed: {guess}");

// --snip--
// ANCHOR_END: here
Expand Down
Loading