Skip to content

ch15 スマートポインタの和訳を最新版に更新 #263

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 39 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
39 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
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
ch06 Enumとパターンマッチングの和訳を最新版に更新
  • Loading branch information
shinmili committed Feb 4, 2025
commit 70c7a138d14c88b1647ad6e06012c11e45405b62
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// ANCHOR: here
#[derive(Debug)] // so we can inspect the state in a minute
#[derive(Debug)] // すぐに州を検査できるように
enum UsState {
Alabama,
Alaska,
// --snip--
// ----
}

enum Coin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fn main() {
// ANCHOR: here
let some_u8_value = Some(0u8);
match some_u8_value {
Some(3) => println!("three"),
let config_max = Some(3u8);
match config_max {
Some(max) => println!("The maximum is configured to be {}", max),
_ => (),
}
// ANCHOR_END: here
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// ANCHOR: here
struct QuitMessage; // unit struct
struct QuitMessage; // ユニット構造体
struct MoveMessage {
x: i32,
y: i32,
}
struct WriteMessage(String); // tuple struct
struct ChangeColorMessage(i32, i32, i32); // tuple struct
struct WriteMessage(String); // タプル構造体
struct ChangeColorMessage(i32, i32, i32); // タプル構造体
// ANCHOR_END: here

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {
// ANCHOR: here
impl Message {
fn call(&self) {
// method body would be defined here
// メソッド本体はここで定義されます
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fn main() {
// ANCHOR: here
let some_number = Some(5);
let some_string = Some("a string");
let some_char = Some('e');

let absent_number: Option<i32> = None;
// ANCHOR_END: here
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
$ cargo run
Compiling enums v0.1.0 (file:///projects/enums)
error[E0277]: cannot add `std::option::Option<i8>` to `i8`
error[E0277]: cannot add `Option<i8>` to `i8`
(エラー: `Option<i8>`を`i8`に足すことはできません)
--> src/main.rs:5:17
|
5 | let sum = x + y;
| ^ no implementation for `i8 + std::option::Option<i8>`
| ^ no implementation for `i8 + Option<i8>`
(`i8 + `Option<i8>`のための実装がありません)
|
= help: the trait `std::ops::Add<std::option::Option<i8>>` is not implemented for `i8`

error: aborting due to previous error
= help: the trait `Add<Option<i8>>` is not implemented for `i8`
(ヘルプ: トレイト`Add<Option<i8>`が`i8`に対して実装されていません)
= help: the following other types implement trait `Add<Rhs>`:
(ヘルプ: 以下の型であればトレイト`Add<Rhs>`を実装しています:)
<i8 as Add>
<i8 as Add<&i8>>
<&'a i8 as Add<i8>>
<&i8 as Add<&i8>>

For more information about this error, try `rustc --explain E0277`.
error: could not compile `enums`.

To learn more, run the command again with --verbose.
error: could not compile `enums` (bin "enums") due to 1 previous error
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
$ cargo run
Compiling enums v0.1.0 (file:///projects/enums)
error[E0004]: non-exhaustive patterns: `None` not covered
(エラー: 包括的でないパターン: `None`が網羅されていません)
--> src/main.rs:3:15
|
3 | match x {
| ^ pattern `None` not covered
(パターン`None`が網羅されていません)
|
note: `Option<i32>` defined here
--> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:570:1
::: /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:574:5
|
= note: not covered
= note: the matched value is of type `Option<i32>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
(ヘルプ: ワイルドカードパターンか、以下に示すように明示的なパターンを持つアームを追加することで、すべての可能な場合が確実に処理されるようにしてください)
|
4 ~ Some(i) => Some(i + 1),
5 ~ None => todo!(),
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms

error: aborting due to previous error

For more information about this error, try `rustc --explain E0004`.
error: could not compile `enums`.

To learn more, run the command again with --verbose.
error: could not compile `enums` (bin "enums") due to 1 previous error

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fn main() {
let some_u8_value = Some(0u8);
// ANCHOR: here
if let Some(3) = some_u8_value {
println!("three");
let config_max = Some(3u8);
if let Some(max) = config_max {
println!("The maximum is configured to be {}", max);
}
// ANCHOR_END: here
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
enum UsState {
Alabama,
Alaska,
// --snip--
// ----
}

enum Coin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
enum UsState {
Alabama,
Alaska,
// --snip--
// ----
}

enum Coin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fn main() {
// ANCHOR: here
let dice_roll = 9;
match dice_roll {
3 => add_fancy_hat(),
7 => remove_fancy_hat(),
other => move_player(other),
}

fn add_fancy_hat() {}
fn remove_fancy_hat() {}
fn move_player(num_spaces: u8) {}
// ANCHOR_END: here
}

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
@@ -0,0 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
edition = "2021"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fn main() {
// ANCHOR: here
let dice_roll = 9;
match dice_roll {
3 => add_fancy_hat(),
7 => remove_fancy_hat(),
_ => reroll(),
}

fn add_fancy_hat() {}
fn remove_fancy_hat() {}
fn reroll() {}
// ANCHOR_END: here
}

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
@@ -0,0 +1,6 @@
[package]
name = "enums"
version = "0.1.0"
edition = "2021"

[dependencies]
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