]>
Commit | Line | Data |
---|---|---|
c1a9b12d SL |
1 | % Example: Implementing Vec |
2 | ||
3 | To bring everything together, we're going to write `std::Vec` from scratch. | |
4 | Because all the best tools for writing unsafe code are unstable, this | |
54a0048b | 5 | project will only work on nightly (as of Rust 1.9.0). With the exception of the |
c1a9b12d SL |
6 | allocator API, much of the unstable code we'll use is expected to be stabilized |
7 | in a similar form as it is today. | |
8 | ||
9 | However we will generally try to avoid unstable code where possible. In | |
10 | particular we won't use any intrinsics that could make a code a little | |
11 | bit nicer or efficient because intrinsics are permanently unstable. Although | |
12 | many intrinsics *do* become stabilized elsewhere (`std::ptr` and `str::mem` | |
13 | consist of many intrinsics). | |
14 | ||
15 | Ultimately this means our implementation may not take advantage of all | |
16 | possible optimizations, though it will be by no means *naive*. We will | |
17 | definitely get into the weeds over nitty-gritty details, even | |
18 | when the problem doesn't *really* merit it. | |
19 | ||
20 | You wanted advanced. We're gonna go advanced. |