Example: Implementing Vec

To bring everything together, we’re going to write std::Vec from scratch.Because all the best tools for writing unsafe code are unstable, thisproject will only work on nightly (as of Rust 1.9.0). With the exception of theallocator API, much of the unstable code we’ll use is expected to be stabilizedin a similar form as it is today.

However we will generally try to avoid unstable code where possible. Inparticular we won’t use any intrinsics that could make a code a littlebit nicer or efficient because intrinsics are permanently unstable. Althoughmany intrinsics do become stabilized elsewhere (std::ptr and str::memconsist of many intrinsics).

Ultimately this means our implementation may not take advantage of allpossible optimizations, though it will be by no means naive. We willdefinitely get into the weeds over nitty-gritty details, evenwhen the problem doesn’t really merit it.

You wanted advanced. We’re gonna go advanced.