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