Skip to content

Commit fc8a1cf

Browse files
committed
Update original
1 parent 89d772f commit fc8a1cf

Some content is hidden

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

70 files changed

+1328
-353
lines changed

.examples-en

Submodule .examples-en updated 74 files

src/SUMMARY.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@
100100
- [match](flow_control/match.md)
101101
- [Destructuring](flow_control/match/destructuring.md)
102102
- [tuples](flow_control/match/destructuring/destructure_tuple.md)
103+
- [arrays/slices](flow_control/match/destructuring/destructure_slice.md)
103104
- [enums](flow_control/match/destructuring/destructure_enum.md)
104105
- [pointers/ref](flow_control/match/destructuring/destructure_pointers.md)
105106
- [structs](flow_control/match/destructuring/destructure_structures.md)
106107
- [Guards](flow_control/match/guard.md)
107108
- [Binding](flow_control/match/binding.md)
108109
- [if let](flow_control/if_let.md)
110+
- [let-else](flow_control/let_else.md)
109111
- [while let](flow_control/while_let.md)
110112
-->
111113
- [条件分岐](flow_control.md)
@@ -315,10 +317,12 @@
315317
<!--
316318
- [Error handling](error.md)
317319
- [`panic`](error/panic.md)
320+
- [`abort` & `unwind`](error/abort_unwind.md)
318321
- [`Option` & `unwrap`](error/option_unwrap.md)
319322
- [Unpacking options with `?`](error/option_unwrap/question_mark.md)
320323
- [Combinators: `map`](error/option_unwrap/map.md)
321324
- [Combinators: `and_then`](error/option_unwrap/and_then.md)
325+
- [Defaults: `or`, `or_else`, `get_or_insert`, 'get_or_insert_with`](error/option_unwrap/defaults.md)
322326
- [`Result`](error/result.md)
323327
- [`map` for `Result`](error/result/result_map.md)
324328
- [aliases for `Result`](error/result/result_alias.md)
@@ -423,6 +427,7 @@
423427

424428
<!--
425429
- [Unsafe Operations](unsafe.md)
430+
- [Inline assembly](unsafe/asm.md)
426431
-->
427432
- [安全でない操作](unsafe.md)
428433

@@ -432,7 +437,7 @@
432437
<!--
433438
- [Meta](meta.md)
434439
- [Documentation](meta/doc.md)
435-
- [Playpen](meta/playpen.md)
440+
- [Playground](meta/playground.md)
436441
-->
437442
- [周辺情報](meta.md)
438443
- [ドキュメンテーション](meta/doc.md)

src/attribute.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ can be used to/for:
1919
* link to a foreign library
2020
* mark functions as unit tests
2121
* mark functions that will be part of a benchmark
22+
* [attribute like macros][macros]
2223
-->
2324
* [コンパイル時の条件分岐][cfg]
2425
* [クレート名、バージョン、種類(バイナリか、ライブラリか)の設定][crate]
@@ -57,3 +58,4 @@ Attributes can have multiple values and can be separated over multiple lines, to
5758
[cfg]: attribute/cfg.md
5859
[crate]: attribute/crate.md
5960
[lint]: https://en.wikipedia.org/wiki/Lint_%28software%29
61+
[macros]: https://doc.rust-lang.org/book/ch19-06-macros.html#attribute-like-macros

src/attribute/cfg.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ utilize identical argument syntax.
2020
前者は条件付きコンパイルを行いますが、後者は`true`または`false`リテラルに評価され実行時にチェックすることが可能です。
2121
いずれの場合も適切なシンタックスで記述する必要があります。
2222

23+
`cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For example, all blocks in an if/else expression need to be valid when `cfg!` is used for the condition, regardless of what `cfg!` is evaluating.
24+
2325
```rust,editable
2426
// This function only gets compiled if the target OS is linux
2527
// この関数はターゲットOSがLinuxの時のみコンパイルされる。

src/cargo/conventions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ foo
3838
```
3939

4040
<!--
41-
To tell `cargo` to compile or run this binary as opposed to the default or other
42-
binaries, we just pass `cargo` the `--bin my_other_bin` flag, where `my_other_bin`
43-
is the name of the binary we want to work with.
41+
To tell `cargo` to only compile or run this binary, we just pass `cargo` the
42+
`--bin my_other_bin` flag, where `my_other_bin` is the name of the binary we
43+
want to work with.
4444
-->
45-
デフォルトバイナリや他のバイナリではなく、このバイナリをコンパイルや実行するように`cargo`に伝えるには、`cargo``--bin my_other_bin`フラグを渡します。ここでは`my_other_bin`が対象のバイナリの名前です。
45+
このバイナリだけをコンパイルや実行するように`cargo`に伝えるには、`cargo``--bin my_other_bin`フラグを渡します。ここでは`my_other_bin`が対象のバイナリの名前です。
4646

4747
<!--
4848
In addition to extra binaries, `cargo` supports [more features] such as

src/cargo/deps.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Rustのプロジェクトを新しく作るには下記のようにします。
2121
# バイナリ
2222
cargo new foo
2323

24-
# OR A library
25-
# またはライブラリ
26-
cargo new --lib foo
24+
# A library
25+
# ライブラリ
26+
cargo new --lib bar
2727
```
2828

2929
<!--
@@ -38,18 +38,23 @@ After the above commands, you should see a file hierarchy like this:
3838
上のコマンドを実行すると、次のようなファイル階層ができます。
3939

4040
```txt
41-
foo
42-
├── Cargo.toml
43-
└── src
44-
└── main.rs
41+
.
42+
├── bar
43+
│ ├── Cargo.toml
44+
│ └── src
45+
│ └── lib.rs
46+
└── foo
47+
├── Cargo.toml
48+
└── src
49+
└── main.rs
4550
```
4651

4752
<!--
48-
The `main.rs` is the root source file for your new project -- nothing new there.
49-
The `Cargo.toml` is the config file for `cargo` for this project (`foo`). If you
53+
The `main.rs` is the root source file for your new `foo` project -- nothing new there.
54+
The `Cargo.toml` is the config file for `cargo` for this project. If you
5055
look inside it, you should see something like this:
5156
-->
52-
`main.rs`がこの新規プロジェクトのルートのソースファイルです。なにも新しいことはありませんね。`Cargo.toml`はこのプロジェクト(`foo`)の`cargo`の設定ファイルです。中を見てみるとこのようになっています。
57+
`main.rs`がこの新規プロジェクト `foo` のルートのソースファイルです。なにも新しいことはありませんね。`Cargo.toml`はこのプロジェクトの`cargo`の設定ファイルです。中を見てみるとこのようになっています。
5358

5459
```toml
5560
[package]

src/conversion/from_into.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl From<i32> for Number {
8787
8888
fn main() {
8989
let int = 5;
90-
// Try removing the type declaration
90+
// Try removing the type annotation
9191
let num: Number = int.into();
9292
println!("My number is {:?}", num);
9393
}

src/crates/using_lib.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() {
2020
```txt
2121
# Where library.rlib is the path to the compiled library, assumed that it's
2222
# in the same directory here:
23-
$ rustc executable.rs --extern rary=library.rlib --edition=2018 && ./executable
23+
$ rustc executable.rs --extern rary=library.rlib && ./executable
2424
called rary's `public_function()`
2525
called rary's `indirect_access()`, that
2626
> called rary's `private_function()`

src/custom_types/enum.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<!--
77
The `enum` keyword allows the creation of a type which may be one of a few
8-
different variants. Any variant which is valid as a `struct` is also valid as
8+
different variants. Any variant which is valid as a `struct` is also valid in
99
an `enum`.
1010
-->
1111
列挙型(`enum`)はいくつかの異なる要素型の中から1つを選ぶような場合に使用します。構造体(`struct`)の定義を満たすものならば何でも`enum` の要素型として使用できます。
@@ -21,7 +21,7 @@ an `enum`.
2121
// `KeyPress(char) != Paste(String)` である。
2222
// 要素型は互いに異なり、互いに非依存である。
2323
enum WebEvent {
24-
// An `enum` may either be `unit-like`,
24+
// An `enum` variant may either be `unit-like`,
2525
// `enum`要素型はユニット風でもよい
2626
PageLoad,
2727
PageUnload,
@@ -41,7 +41,7 @@ fn inspect(event: WebEvent) {
4141
match event {
4242
WebEvent::PageLoad => println!("page loaded"),
4343
WebEvent::PageUnload => println!("page unloaded"),
44-
// Destructure `c` from inside the `enum`.
44+
// Destructure `c` from inside the `enum` variant.
4545
WebEvent::KeyPress(c) => println!("pressed '{}'.", c),
4646
WebEvent::Paste(s) => println!("pasted \"{}\".", s),
4747
// Destructure `Click` into `x` and `y`.

src/custom_types/structs.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ There are three types of structures ("structs") that can be created using the
1919
* ユニット。これはフィールドを持たず、ジェネリック型を扱う際に有効です。
2020

2121
```rust,editable
22+
// An attribute to hide warnings for unused code.
23+
#![allow(dead_code)]
24+
2225
#[derive(Debug)]
2326
struct Person {
2427
name: String,

0 commit comments

Comments
 (0)
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