Skip to content

Commit 2296c28

Browse files
committed
ch14 CargoとCrates.ioについてより詳しくの和訳を最新版に更新
rust-lang/book@19c40bf
1 parent 239347a commit 2296c28

File tree

56 files changed

+713
-746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+713
-746
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "my_crate"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch14-more-about-cargo/listing-14-01/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// Adds one to the number given.
2+
/// 与えられた数値に1を足す。
23
///
34
/// # Examples
45
///
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "my_crate"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch14-more-about-cargo/listing-14-02/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
//!
44
//! `my_crate` is a collection of utilities to make performing certain
55
//! calculations more convenient.
6-
6+
//!
7+
//! # 自分のクレート
8+
//!
9+
//! `my_crate`は、ユーティリティの集まりであり、特定の計算をより便利に行うことができます。
710
/// Adds one to the number given.
811
// --snip--
912
// ANCHOR_END: here
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "art"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch14-more-about-cargo/listing-14-03/src/lib.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@
22
//! # Art
33
//!
44
//! A library for modeling artistic concepts.
5+
//!
6+
//! # 芸術
7+
//!
8+
//! 芸術的な概念をモデル化するライブラリ。
59
610
pub mod kinds {
711
/// The primary colors according to the RYB color model.
12+
/// RYBカラーモデルによる主色。
813
pub enum PrimaryColor {
914
Red,
1015
Yellow,
1116
Blue,
1217
}
1318

1419
/// The secondary colors according to the RYB color model.
20+
/// RYBカラーモデルによる副色。
1521
pub enum SecondaryColor {
1622
Orange,
1723
Green,
@@ -24,13 +30,12 @@ pub mod utils {
2430

2531
/// Combines two primary colors in equal amounts to create
2632
/// a secondary color.
33+
/// 2つの主色を同じ割合で混合し、副色にする。
2734
pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
2835
// --snip--
2936
// ANCHOR_END: here
30-
SecondaryColor::Orange
37+
unimplemented!();
3138
// ANCHOR: here
3239
}
3340
}
3441
// ANCHOR_END: here
35-
36-
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "art"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "art"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "art"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch14-more-about-cargo/listing-14-07/add/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

listings/ch14-more-about-cargo/listing-14-07/add/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
members = [
44
"adder",
5-
"add-one",
5+
"add_one",
66
]

listings/ch14-more-about-cargo/listing-14-07/add/add-one/Cargo.toml

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "add_one"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[package]
22
name = "adder"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
87

9-
add-one = { path = "../add-one" }
8+
add_one = { path = "../add_one" }

listings/ch14-more-about-cargo/listing-14-07/add/adder/src/main.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ use add_one;
22

33
fn main() {
44
let num = 10;
5-
println!(
6-
"Hello, world! {} plus one is {}!",
7-
num,
8-
add_one::add_one(num)
9-
);
5+
// "こんにちは世界!{num}+1は{}!"
6+
println!("Hello, world! {num} plus one is {}!", add_one::add_one(num));
107
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "adder"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch14-more-about-cargo/no-listing-02-workspace-with-two-crates/add/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

listings/ch14-more-about-cargo/no-listing-02-workspace-with-two-crates/add/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
members = [
44
"adder",
5-
"add-one",
5+
"add_one",
66
]

listings/ch14-more-about-cargo/no-listing-02-workspace-with-two-crates/add/add-one/Cargo.toml

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "add_one"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[package]
22
name = "adder"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
8-
9-
add-one = { path = "../add-one" }
7+
add_one = { path = "../add_one" }

listings/ch14-more-about-cargo/no-listing-03-workspace-with-external-dependency/add/Cargo.lock

+36-48
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

listings/ch14-more-about-cargo/no-listing-03-workspace-with-external-dependency/add/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
members = [
44
"adder",
5-
"add-one",
5+
"add_one",
66
]

listings/ch14-more-about-cargo/no-listing-03-workspace-with-external-dependency/add/add-one/Cargo.toml

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "add_one"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
rand = "0.8.5"
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[package]
22
name = "adder"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
87

9-
add-one = { path = "../add-one" }
8+
add_one = { path = "../add_one" }

0 commit comments

Comments
 (0)