Skip to content

ch13 関数型言語の機能: イテレータとクロージャの和訳を最新版に更新 #261

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

Open
wants to merge 36 commits into
base: master-ja
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 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
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ch12 入出力プロジェクト: コマンドラインプログラムを構築するの和訳を最新版に更新
  • Loading branch information
shinmili committed Feb 4, 2025
commit 57c558896aa0b96753d68757adac2df4e1d613f5
3 changes: 1 addition & 2 deletions listings/ch12-an-io-project/listing-12-01/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "minigrep"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
4 changes: 3 additions & 1 deletion listings/ch12-an-io-project/listing-12-01/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ $ cargo run
Compiling minigrep v0.1.0 (file:///projects/minigrep)
Finished dev [unoptimized + debuginfo] target(s) in 0.61s
Running `target/debug/minigrep`
["target/debug/minigrep"]
[src/main.rs:5:5] args = [
"target/debug/minigrep",
]
2 changes: 1 addition & 1 deletion listings/ch12-an-io-project/listing-12-01/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ use std::env;

fn main() {
let args: Vec<String> = env::args().collect();
println!("{:?}", args);
dbg!(args);
}
3 changes: 1 addition & 2 deletions listings/ch12-an-io-project/listing-12-02/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "minigrep"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
2 changes: 1 addition & 1 deletion listings/ch12-an-io-project/listing-12-02/output.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$ cargo run test sample.txt
$ cargo run -- test sample.txt
Compiling minigrep v0.1.0 (file:///projects/minigrep)
Finished dev [unoptimized + debuginfo] target(s) in 0.0s
Running `target/debug/minigrep test sample.txt`
Expand Down
6 changes: 4 additions & 2 deletions listings/ch12-an-io-project/listing-12-02/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ fn main() {
let args: Vec<String> = env::args().collect();

let query = &args[1];
let filename = &args[2];
let file_path = &args[2];

// "{}を検索します"
println!("Searching for {}", query);
println!("In file {}", filename);
// "ファイル{}の中で"
println!("In file {}", file_path);
}
3 changes: 1 addition & 2 deletions listings/ch12-an-io-project/listing-12-03/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "minigrep"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
6 changes: 3 additions & 3 deletions listings/ch12-an-io-project/listing-12-03/poem.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Im nobody! Who are you?
I'm nobody! Who are you?
Are you nobody, too?
Then theres a pair of us - dont tell!
Theyd banish us, you know.
Then there's a pair of us - don't tell!
They'd banish us, you know.

How dreary to be somebody!
How public, like a frog
Expand Down
4 changes: 2 additions & 2 deletions listings/ch12-an-io-project/listing-12-03/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ fn main() {
let args: Vec<String> = env::args().collect();

let query = &args[1];
let filename = &args[2];
let file_path = &args[2];

println!("Searching for {}", query);
println!("In file {}", filename);
println!("In file {}", file_path);
}
3 changes: 1 addition & 2 deletions listings/ch12-an-io-project/listing-12-04/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "minigrep"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
8 changes: 4 additions & 4 deletions listings/ch12-an-io-project/listing-12-04/output.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
$ cargo run the poem.txt
$ cargo run -- the poem.txt
Compiling minigrep v0.1.0 (file:///projects/minigrep)
Finished dev [unoptimized + debuginfo] target(s) in 0.0s
Running `target/debug/minigrep the poem.txt`
Searching for the
In file poem.txt
With text:
Im nobody! Who are you?
I'm nobody! Who are you?
Are you nobody, too?
Then theres a pair of us - dont tell!
Theyd banish us, you know.
Then there's a pair of us - don't tell!
They'd banish us, you know.

How dreary to be somebody!
How public, like a frog
Expand Down
6 changes: 3 additions & 3 deletions listings/ch12-an-io-project/listing-12-04/poem.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Im nobody! Who are you?
I'm nobody! Who are you?
Are you nobody, too?
Then theres a pair of us - dont tell!
Theyd banish us, you know.
Then there's a pair of us - don't tell!
They'd banish us, you know.

How dreary to be somebody!
How public, like a frog
Expand Down
12 changes: 7 additions & 5 deletions listings/ch12-an-io-project/listing-12-04/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ fn main() {
let args: Vec<String> = env::args().collect();

let query = &args[1];
let filename = &args[2];
let file_path = &args[2];

println!("Searching for {}", query);
// ANCHOR: here
println!("In file {}", filename);
println!("In file {}", file_path);

let contents = fs::read_to_string(filename)
.expect("Something went wrong reading the file");
let contents = fs::read_to_string(file_path)
// "ファイルを読み込むことができるはずでした"
.expect("Should have been able to read the file");

println!("With text:\n{}", contents);
// "テキスト:\n{contents}"
println!("With text:\n{contents}");
}
// ANCHOR_END: here
3 changes: 1 addition & 2 deletions listings/ch12-an-io-project/listing-12-05/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "minigrep"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
6 changes: 3 additions & 3 deletions listings/ch12-an-io-project/listing-12-05/poem.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Im nobody! Who are you?
I'm nobody! Who are you?
Are you nobody, too?
Then theres a pair of us - dont tell!
Theyd banish us, you know.
Then there's a pair of us - don't tell!
They'd banish us, you know.

How dreary to be somebody!
How public, like a frog
Expand Down
14 changes: 7 additions & 7 deletions listings/ch12-an-io-project/listing-12-05/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ use std::fs;
fn main() {
let args: Vec<String> = env::args().collect();

let (query, filename) = parse_config(&args);
let (query, file_path) = parse_config(&args);

// --snip--
// ANCHOR_END: here

println!("Searching for {}", query);
println!("In file {}", filename);
println!("In file {}", file_path);

let contents = fs::read_to_string(filename)
.expect("Something went wrong reading the file");
let contents = fs::read_to_string(file_path)
.expect("Should have been able to read the file");

println!("With text:\n{}", contents);
println!("With text:\n{contents}");
// ANCHOR: here
}

fn parse_config(args: &[String]) -> (&str, &str) {
let query = &args[1];
let filename = &args[2];
let file_path = &args[2];

(query, filename)
(query, file_path)
}
// ANCHOR_END: here
3 changes: 1 addition & 2 deletions listings/ch12-an-io-project/listing-12-06/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "minigrep"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
6 changes: 3 additions & 3 deletions listings/ch12-an-io-project/listing-12-06/poem.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Im nobody! Who are you?
I'm nobody! Who are you?
Are you nobody, too?
Then theres a pair of us - dont tell!
Theyd banish us, you know.
Then there's a pair of us - don't tell!
They'd banish us, you know.

How dreary to be somebody!
How public, like a frog
Expand Down
14 changes: 7 additions & 7 deletions listings/ch12-an-io-project/listing-12-06/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ fn main() {
let config = parse_config(&args);

println!("Searching for {}", config.query);
println!("In file {}", config.filename);
println!("In file {}", config.file_path);

let contents = fs::read_to_string(config.filename)
.expect("Something went wrong reading the file");
let contents = fs::read_to_string(config.file_path)
.expect("Should have been able to read the file");

// --snip--
// ANCHOR_END: here

println!("With text:\n{}", contents);
println!("With text:\n{contents}");
// ANCHOR: here
}

struct Config {
query: String,
filename: String,
file_path: String,
}

fn parse_config(args: &[String]) -> Config {
let query = args[1].clone();
let filename = args[2].clone();
let file_path = args[2].clone();

Config { query, filename }
Config { query, file_path }
}
// ANCHOR_END: here
3 changes: 1 addition & 2 deletions listings/ch12-an-io-project/listing-12-07/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "minigrep"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
7 changes: 5 additions & 2 deletions listings/ch12-an-io-project/listing-12-07/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ $ cargo run
Compiling minigrep v0.1.0 (file:///projects/minigrep)
Finished dev [unoptimized + debuginfo] target(s) in 0.0s
Running `target/debug/minigrep`
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', src/main.rs:27:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
thread 'main' panicked at src/main.rs:27:21:
index out of bounds: the len is 1 but the index is 1
(スレッド'main'はsrc/main.rs:27:21でパニックしました:
境界外アクセス: 長さは1なのに添え字も1です)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
6 changes: 3 additions & 3 deletions listings/ch12-an-io-project/listing-12-07/poem.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Im nobody! Who are you?
I'm nobody! Who are you?
Are you nobody, too?
Then theres a pair of us - dont tell!
Theyd banish us, you know.
Then there's a pair of us - don't tell!
They'd banish us, you know.

How dreary to be somebody!
How public, like a frog
Expand Down
14 changes: 7 additions & 7 deletions listings/ch12-an-io-project/listing-12-07/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ fn main() {
// ANCHOR_END: here

println!("Searching for {}", config.query);
println!("In file {}", config.filename);
println!("In file {}", config.file_path);

let contents = fs::read_to_string(config.filename)
.expect("Something went wrong reading the file");
let contents = fs::read_to_string(config.file_path)
.expect("Should have been able to read the file");

println!("With text:\n{}", contents);
println!("With text:\n{contents}");
// ANCHOR: here

// --snip--
Expand All @@ -25,16 +25,16 @@ fn main() {
// ANCHOR_END: here
struct Config {
query: String,
filename: String,
file_path: String,
}

// ANCHOR: here
impl Config {
fn new(args: &[String]) -> Config {
let query = args[1].clone();
let filename = args[2].clone();
let file_path = args[2].clone();

Config { query, filename }
Config { query, file_path }
}
}
// ANCHOR_END: here
3 changes: 1 addition & 2 deletions listings/ch12-an-io-project/listing-12-08/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "minigrep"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
7 changes: 5 additions & 2 deletions listings/ch12-an-io-project/listing-12-08/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ $ cargo run
Compiling minigrep v0.1.0 (file:///projects/minigrep)
Finished dev [unoptimized + debuginfo] target(s) in 0.0s
Running `target/debug/minigrep`
thread 'main' panicked at 'not enough arguments', src/main.rs:26:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
thread 'main' panicked at src/main.rs:26:13:
not enough arguments
(スレッド'main'はsrc/main.rs:26:13でパニックしました:
引数が足りません)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
6 changes: 3 additions & 3 deletions listings/ch12-an-io-project/listing-12-08/poem.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Im nobody! Who are you?
I'm nobody! Who are you?
Are you nobody, too?
Then theres a pair of us - dont tell!
Theyd banish us, you know.
Then there's a pair of us - don't tell!
They'd banish us, you know.

How dreary to be somebody!
How public, like a frog
Expand Down
15 changes: 8 additions & 7 deletions listings/ch12-an-io-project/listing-12-08/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,33 @@ fn main() {
let config = Config::new(&args);

println!("Searching for {}", config.query);
println!("In file {}", config.filename);
println!("In file {}", config.file_path);

let contents = fs::read_to_string(config.filename)
.expect("Something went wrong reading the file");
let contents = fs::read_to_string(config.file_path)
.expect("Should have been able to read the file");

println!("With text:\n{}", contents);
println!("With text:\n{contents}");
}

struct Config {
query: String,
filename: String,
file_path: String,
}

impl Config {
// ANCHOR: here
// --snip--
fn new(args: &[String]) -> Config {
if args.len() < 3 {
// "引数が足りません"
panic!("not enough arguments");
}
// --snip--
// ANCHOR_END: here

let query = args[1].clone();
let filename = args[2].clone();
let file_path = args[2].clone();

Config { query, filename }
Config { query, file_path }
}
}
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy