Skip to content

Commit ef44956

Browse files
committed
Translate untranslated files for '13. Attribute'
1 parent 2d58df7 commit ef44956

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

src/attribute.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ Attributes can take arguments with different syntaxes:
4545
* `#[attribute(key = "value")]`
4646
* `#[attribute(value)]`
4747

48+
<!--
4849
Attributes can have multiple values and can be separated over multiple lines, too:
50+
-->
51+
アトリビュートは複数の値を取ることができ、複数の行に分割することもできます。
4952

5053
```rust,ignore
5154
#[attribute(value, value2)]

src/attribute/cfg.md

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

23+
<!--
2324
`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.
25+
-->
26+
`#[cfg]`と異なり、`cfg!`はコードを削除せず、trueまたはfalseに評価されるだけです。
27+
例えば、`cfg!`が何を評価しているかに関係なく、`cfg!`が条件に利用されるとき、if/else式の中のすべてのブロックが有効でなくてはなりません。
2428

2529
```rust,editable
2630
// This function only gets compiled if the target OS is linux

src/attribute/cfg/custom.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ fn main() {
2020
}
2121
```
2222

23+
<!--
2324
Try to run this to see what happens without the custom `cfg` flag.
25+
-->
26+
独自の`cfg`フラグを用いない場合、何が起きるかやってみてください。
2427

2528
<!--
2629
With the custom `cfg` flag:

src/attribute/crate.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ attribute can be used to set the name of the crate.
1010
-->
1111
`crate_type`アトリビュートは、そのクレートがライブラリ、バイナリのいずれにコンパイルされるべきかをコンパイラに伝えるために使用します。ライブラリの場合は、どのタイプのライブラリであるかも伝えることができます。`crate_name`はクレートの名前を決定するのに使用します。
1212

13+
<!--
1314
However, it is important to note that both the `crate_type` and `crate_name`
1415
attributes have **no** effect whatsoever when using Cargo, the Rust package
1516
manager. Since Cargo is used for the majority of Rust projects, this means
1617
real-world uses of `crate_type` and `crate_name` are relatively limited.
18+
-->
19+
しかし、`crate_type`アトリビュートも`crate_name`アトリビュートも、RustのパッケージマネージャCargoを利用している場合は**何の**影響もないと知っておくことは重要です。Cargoは大半のRustプロジェクトで利用されており、実世界での`crate_type``crate_name`の利用は比較的限られています。
1720

1821
```rust,editable
1922
// This crate is a library

0 commit comments

Comments
 (0)