Skip to content

Commit d755925

Browse files
authored
Translate vec.md (#52)
1 parent 68a9964 commit d755925

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* [競合](races.md)
4141
* [Send and Sync](send-and-sync.md)
4242
* [Atomics](atomics.md)
43-
* [Implementing Vec](vec.md)
43+
* [Vec の実装](vec.md)
4444
* [Layout](vec-layout.md)
4545
* [Allocating](vec-alloc.md)
4646
* [Push and Pop](vec-push-pop.md)

src/vec.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,52 @@
1+
<!--
12
# Example: Implementing Vec
3+
-->
24

5+
# 例: Vec の実装
6+
7+
<!--
38
To bring everything together, we're going to write `std::Vec` from scratch.
49
Because all the best tools for writing unsafe code are unstable, this
510
project will only work on nightly (as of Rust 1.9.0). With the exception of the
611
allocator API, much of the unstable code we'll use is expected to be stabilized
712
in a similar form as it is today.
13+
-->
14+
15+
全てをまとめるために、最初から `std::Vec` を書くことにします。
16+
アンセーフなコードを書くための最良のツールは全部アンステーブルなため、
17+
このプロジェクトは nightly でしか動作しません (Rust 1.9.0 現在) 。
18+
アロケータの API を除いて、使用するアンステーブルなもののほとんどは、
19+
今日の形態に似た状態で、安定版となると予測しています。
820

21+
<!--
922
However we will generally try to avoid unstable code where possible. In
1023
particular we won't use any intrinsics that could make a code a little
1124
bit nicer or efficient because intrinsics are permanently unstable. Although
12-
many intrinsics *do* become stabilized elsewhere (`std::ptr` and `str::mem`
25+
many intrinsics *do* become stabilized elsewhere (`std::ptr` and `std::mem`
1326
consist of many intrinsics).
27+
-->
28+
29+
しかし、なるべくアンステーブルなコードを書くことを避けようと思います。
30+
特に、いかなる intrinsic も使わないことにします。これらはコードを
31+
ちょっと改善したり、効率を良くします。これらを使わない理由は、
32+
intrinsic が永遠にアンステーブルだからです。もっとも、多くの intrinsic は*実際に*
33+
別の場において安定版になっていますが (`std::ptr``std::mem` は、
34+
多くの intrinsic を含んでいます) 。
1435

36+
<!--
1537
Ultimately this means our implementation may not take advantage of all
1638
possible optimizations, though it will be by no means *naive*. We will
1739
definitely get into the weeds over nitty-gritty details, even
1840
when the problem doesn't *really* merit it.
41+
-->
1942

43+
究極には、これは、ここで実装する Vec では可能な最適化を全部は
44+
利用しないということを意味します。だからといって、全く*単純*という訳ではありません。
45+
その問題によって何か*本当に*利益を得ることがないとしても、基本的で
46+
細かいところに突っ込んでいきます。
47+
48+
<!--
2049
You wanted advanced. We're gonna go advanced.
50+
-->
51+
52+
先に進みたいですよね? それでは行きましょう。

0 commit comments

Comments
 (0)