New features:
* `no_std` support (#49).
* `SmallVec<[u8; N]>` implements the `Write` trait (#52).
* Add an `ExtendFromSlice` trait for both `Vec` and `SmallVec` (#54).
Add ExtendFromSlice trait
At Parity we tried to switch from our internal `elastic-array` crate (which has soundness and ergonomics issues) to `smallvec` but the PR that attempted this replaced `extend_from_slice` calls with `push` loops (which are much slower). We could fix this internally, but the discussion around it made me wonder if this would be something that could be useful upstream.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/54)
<!-- Reviewable:end -->
Add no_std support
This library can easily support `no_std` code on `nightly`; it does require the `collections` feature, however. This PR adds support for this feature by enabling a on-by-default `std` feature. This feature can be turned off to support `no_std` mode.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/49)
<!-- Reviewable:end -->
Don't zero the array on initialization
Using `mem::uninitialized` is potentially faster than `mem::zeroed`, and doesn't remove any safety (since both uninitialized memory and zeroed memory are unsafe to read from in general).
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/43)
<!-- Reviewable:end -->
Using `mem::uninitialized` is potentially faster than `mem::zeroed`, and
doesn't remove any safety (since both uninitialized memory and zeroed
memory are unsafe to read from in general).
Add HeapSizeOf trait and from_slice method
Also added some tests for the new methods. The rationale
- from_slice is an ergonomic way to convert a Copy-able slice to a SmallVec (instead of using the From<'a slice> which uses an iterator)
- HeapSizeOf is handy for measuring heap allocations. Especially useful for monitoring something like this. Seems to be part of the servo project anyway.
- Added size 36 to smallvec sizes (was useful to us)
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/42)
<!-- Reviewable:end -->
Implement extend_from_slice and insert_from_slice with memmove optimization
Implement the performance optimized versions of insert_many and extend (from #28). These methods use memmove rather than a looped insert.
If we had function specialization, we could implement these without exposing new methods. Up to the maintainers whether we want to support these new methods.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/29)
<!-- Reviewable:end -->
Implement insert_many<IntoIterator> for SmallVec
This doesn't work as is, but I wanted to put it up for feedback.
According to these docs:
https://doc.rust-lang.org/std/ptr/fn.copy_nonoverlapping.html
The copy_nonoverlapping function copies memory as intended, but the ownership of the values copied are not copied over to dest, so when the box is consumed, the SmallVec does not maintain ownership. Not sure how to do this with unsafe code.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/28)
<!-- Reviewable:end -->
Specify that VecLike derefs to a slice
I believe this is just an oversight. Since `<[T]>::len` is now available through the `Deref` bound I also removed `VecLike::len`.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/38)
<!-- Reviewable:end -->