Skip to content

Commit e5a2c95

Browse files
committed
generate
1 parent eb40fa1 commit e5a2c95

File tree

1 file changed

+52
-19
lines changed

1 file changed

+52
-19
lines changed

public/1.6/book/attributes.html

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<meta name="generator" content="rustdoc">
7-
<title>Attributes</title>
7+
<title>アトリビュート</title>
88

99
<link rel="stylesheet" type="text/css" href="rustbook.css">
1010

@@ -185,24 +185,33 @@
185185
<div id='page'>
186186

187187

188-
<h1 class="title">Attributes</h1>
189-
<p>Declarations can be annotated with ‘attributes’ in Rust. They look like this:</p>
188+
<h1 class="title">アトリビュート</h1>
189+
<!-- % Attributes -->
190+
191+
<!-- Declarations can be annotated with ‘attributes’ in Rust. They look like this: -->
192+
193+
<p>Rustでは以下のように「アトリビュート」によって宣言を修飾することができます。</p>
190194
<span class='rusttest'>fn main() {
191195
#[test]
192196
fn foo() {}
193197
}</span><pre class='rust rust-example-rendered'>
194198
<span class='attribute'>#[<span class='ident'>test</span>]</span></pre>
195199

196-
<p>or like this:</p>
200+
<!-- or like this: -->
201+
202+
<p>または以下のように:</p>
197203
<span class='rusttest'>fn main() {
198204
mod foo {
199205
#![test]
200206
}
201207
}</span><pre class='rust rust-example-rendered'>
202208
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>test</span>]</span></pre>
203209

204-
<p>The difference between the two is the <code>!</code>, which changes what the attribute
205-
applies to:</p>
210+
<!-- The difference between the two is the `!`, which changes what the attribute -->
211+
212+
<!-- applies to: -->
213+
214+
<p>2つの違いは <code>!</code> に有ります、 <code>!</code> はアトリビュートが適用されるものを変更します:</p>
206215
<span class='rusttest'>fn main() {
207216
#[foo]
208217
struct Foo;
@@ -218,12 +227,21 @@ <h1 class="title">Attributes</h1>
218227
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>bar</span>]</span>
219228
}</pre>
220229

221-
<p>The <code>#[foo]</code> attribute applies to the next item, which is the <code>struct</code>
222-
declaration. The <code>#![bar]</code> attribute applies to the item enclosing it, which is
223-
the <code>mod</code> declaration. Otherwise, they’re the same. Both change the meaning of
224-
the item they’re attached to somehow.</p>
230+
<!-- The `#[foo]` attribute applies to the next item, which is the `struct` -->
231+
232+
<!-- declaration. The `#![bar]` attribute applies to the item enclosing it, which is -->
233+
234+
<!-- the `mod` declaration. Otherwise, they’re the same. Both change the meaning of -->
235+
236+
<!-- the item they’re attached to somehow. -->
237+
238+
<p><code>#[foo]</code> アトリビュートは次のアイテムに適用され、この場合は <code>struct</code> 宣言に適用されます。
239+
<code>#![bar]</code> アトリビュートは <code>#![bar]</code> アトリビュートを囲んでいるアイテムに適用され、この場合は <code>mod</code> 宣言に適用されます。
240+
その他の点については同じであり、どちらも適用されたアイテムの意味を変化させます。</p>
225241

226-
<p>For example, consider a function like this:</p>
242+
<!-- For example, consider a function like this: -->
243+
244+
<p>例を挙げると、たとえば以下の様な関数では:</p>
227245
<span class='rusttest'>fn main() {
228246
#[test]
229247
fn check() {
@@ -235,11 +253,18 @@ <h1 class="title">Attributes</h1>
235253
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='number'>2</span>, <span class='number'>1</span> <span class='op'>+</span> <span class='number'>1</span>);
236254
}</pre>
237255

238-
<p>It is marked with <code>#[test]</code>. This means it’s special: when you run
239-
<a href="testing.html">tests</a>, this function will execute. When you compile as usual, it won’t
240-
even be included. This function is now a test function.</p>
256+
<!-- It is marked with `#[test]`. This means it’s special: when you run -->
257+
258+
<!-- [tests][tests], this function will execute. When you compile as usual, it won’t -->
259+
260+
<!-- even be included. This function is now a test function. -->
261+
262+
<p>この関数は <code>#[test]</code> によってマークされており、これは [テスト][tests] を走らせた時に実行されるという特別な意味になります。
263+
通常通りにコンパイルをした場合は、コンパイル結果に含まれません。この関数は今やテスト関数なのです。</p>
264+
265+
<!-- Attributes may also have additional data: -->
241266

242-
<p>Attributes may also have additional data:</p>
267+
<p>アトリビュートは以下のように、追加のデータを持つことができます:</p>
243268
<span class='rusttest'>fn main() {
244269
#[inline(always)]
245270
fn super_fast_fn() {
@@ -248,7 +273,9 @@ <h1 class="title">Attributes</h1>
248273
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span>
249274
<span class='kw'>fn</span> <span class='ident'>super_fast_fn</span>() {</pre>
250275

251-
<p>Or even keys and values:</p>
276+
<!-- Or even keys and values: -->
277+
278+
<p>また、キーと値についても持つことができます:</p>
252279
<span class='rusttest'>fn main() {
253280
#[cfg(target_os = &quot;macos&quot;)]
254281
mod macos_only {
@@ -257,9 +284,15 @@ <h1 class="title">Attributes</h1>
257284
<span class='attribute'>#[<span class='ident'>cfg</span>(<span class='ident'>target_os</span> <span class='op'>=</span> <span class='string'>&quot;macos&quot;</span>)]</span>
258285
<span class='kw'>mod</span> <span class='ident'>macos_only</span> {</pre>
259286

260-
<p>Rust attributes are used for a number of different things. There is a full list
261-
of attributes <a href="../reference.html#attributes">in the reference</a>. Currently, you are not allowed to
262-
create your own attributes, the Rust compiler defines them.</p>
287+
<!-- Rust attributes are used for a number of different things. There is a full list -->
288+
289+
<!-- of attributes [in the reference][reference]. Currently, you are not allowed to -->
290+
291+
<!-- create your own attributes, the Rust compiler defines them. -->
292+
293+
<p>Rustのアトリビュートは様々なことに利用されます。
294+
すべてのアトリビュートのリストは [リファレンス][reference] に載っています。
295+
現在は、Rustコンパイラーによって定義されている以外の独自のアトリビュートを作成することは許可されていません。</p>
263296

264297
<script type="text/javascript">
265298
window.playgroundUrl = "https://play.rust-lang.org";

0 commit comments

Comments
 (0)