Commit Graph

125 Commits

Author SHA1 Message Date
bors-servo feed3fe02a Auto merge of #53 - mbrubeck:no_std, r=emilio
Document and test no_std support

This builds on the new "std" Cargo feature added in #49.

<!-- 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/53)
<!-- Reviewable:end -->
2017-06-28 18:05:26 -07:00
Matt Brubeck f59b4e9aee Release version 0.4.1
New features:

* `no_std` support (#49).
* `SmallVec<[u8; N]>` implements the `Write` trait (#52).
* Add an `ExtendFromSlice` trait for both `Vec` and `SmallVec` (#54).
2017-06-28 11:11:18 -07:00
Matt Brubeck 8cffbb4bb3 Document no_std support 2017-06-28 11:10:10 -07:00
Matt Brubeck 5c4a6bb2df Point to docs.rs for documentation
(because Servo isn't always using the latest version of this crate)
2017-06-28 11:10:10 -07:00
Matt Brubeck b0cd68e5d6 Make tests work without libstd 2017-06-28 11:10:10 -07:00
Matt Brubeck 617f79c27d Use liballoc instead of libcollections in no_std mode
libcollections was deprecated in rust-lang/rust#42648 and its contents
were moved to liballoc.
2017-06-28 11:10:10 -07:00
bors-servo f4f8c60a13 Auto merge of #54 - Vurich:master, r=mbrubeck
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 -->
2017-06-28 09:24:46 -07:00
Vurich 52f9f43add Add ExtendFromSlice trait 2017-06-28 09:57:12 +02:00
bors-servo 3fe8b1d214 Auto merge of #52 - chpio:master, r=mbrubeck
impl std::io::Write for SmallVec

<!-- 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/52)
<!-- Reviewable:end -->
2017-06-22 11:19:47 -07:00
Thomas Heck df10b7aca1 impl std::io::Write for SmallVec 2017-06-22 12:18:37 +02:00
bors-servo b56cb3ea96 Auto merge of #49 - Pratyush:master, r=mbrubeck
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 -->
2017-06-20 15:09:37 -07:00
bors-servo ec39fc927a Auto merge of #50 - rphmeier:bump-heapsize, r=jdm
bump heapsize to 0.4.0

<!-- 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/50)
<!-- Reviewable:end -->
2017-05-20 15:30:19 -05:00
Robert Habermeier dbcf724dea bump heapsize
includes a version bump of the crate itself
2017-05-20 16:27:03 -04:00
Pratyush Mishra 748f2f54b9 Add no_std support 2017-05-20 11:29:55 -07:00
bors-servo 8ffbea5785 Auto merge of #48 - SergioBenitez:master, r=emilio
Add from_vec method for efficient creation from a Vec.

I also bumped the version to 0.3.3 for easy publishing.

<!-- 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/48)
<!-- Reviewable:end -->
2017-03-29 05:20:28 -05:00
Sergio Benitez 1fc1d85a6d Add tests for from_vec. 2017-03-29 03:14:25 -07:00
Sergio Benitez 7d4b6041ef Bump to 0.3.3. 2017-03-29 01:37:00 -07:00
Sergio Benitez af45fd3b7a Add from_vec method for efficient creation from a Vec. 2017-03-29 01:36:34 -07:00
bors-servo 77e112dcc5 Auto merge of #47 - mbrubeck:travis, r=emilio
Re-enable cargo bench on Travis

This reverts commit 87f12ebf70 which disabled `cargo bench` on Travis because of #44  which is now fixed.

<!-- 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/47)
<!-- Reviewable:end -->
2017-03-23 07:55:38 -07:00
Matt Brubeck a37c725f76 Revert "Temporarily disable cargo bench because of #44."
This reverts commit 87f12ebf70.
2017-03-23 07:51:27 -07:00
bors-servo 56ef5244b2 Auto merge of #43 - mbrubeck:uninit, r=jdm
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 -->
2017-03-22 14:41:01 -07:00
bors-servo b81e882a67 Auto merge of #45 - mbrubeck:into-vec, r=emilio
Add SmallVec::into_vec

Converts a SmallVec to a Vec, without reallocating if the SmallVec has already spilled onto the heap.

<!-- 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/45)
<!-- Reviewable:end -->
2017-03-22 14:39:46 -07:00
bors-servo 165c5685c3 Auto merge of #46 - mbrubeck:travis, r=mbrubeck
Temporarily disable `cargo bench` because of #44.

<!-- 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/46)
<!-- Reviewable:end -->
2017-03-22 14:38:31 -07:00
Matt Brubeck 87f12ebf70 Temporarily disable cargo bench because of #44. 2017-03-22 14:36:58 -07:00
Matt Brubeck 095d5ad98d Bump version to 0.3.2 2017-03-22 14:32:38 -07:00
Matt Brubeck 185e47fa9c Add SmallVec::into_vec 2017-03-22 14:27:01 -07:00
Matt Brubeck 65144d33f5 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).
2017-03-22 14:12:47 -07:00
bors-servo 4ae0d2d1bf Auto merge of #42 - nipunn1313:heapsize, r=jdm
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 -->
2017-03-16 14:58:45 -07:00
Nipunn Koorapati f61bbaa79f Remove specialization feature 2017-03-16 14:39:30 -07:00
Nipunn Koorapati cd5250d145 Add featureflag for heapsizeof 2017-03-16 11:14:10 -07:00
Nipunn Koorapati 82ee158e68 Add a benchmark for from_slice
Because it seems like good practice.
2017-03-14 12:10:18 -07:00
Nipunn Koorapati 33f1bc6ace Add HeapSizeOf trait and from_slice method 2017-03-14 11:22:43 -07:00
bors-servo a98283225d Auto merge of #29 - nipunn1313:extend_slice, r=jdm
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 -->
2017-01-25 06:14:31 -08:00
Nipunn Koorapati 2a8859106c Add bench insert_from_slice 2017-01-24 23:35:00 -08:00
Nipunn Koorapati 24f52bd44c Add benchmark for extend_from_slice 2017-01-24 23:34:59 -08:00
Nipunn Koorapati 97678a0332 Rename to extend_from_slice and insert_from_slice 2017-01-24 23:34:59 -08:00
Nipunn Koorapati 3665ccd790 Implement extend_slice and insert_slice with memcpy optimization 2017-01-24 23:34:59 -08:00
bors-servo bbb18c42eb Auto merge of #28 - nipunn1313:insert_slice, r=jdm
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 -->
2017-01-19 15:53:05 -08:00
bors-servo 76bc98e749 Auto merge of #40 - mbrubeck:docs, r=Ms2ger
Docs, code cleanup, and misc. fixes for smallvec

<!-- 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/40)
<!-- Reviewable:end -->
2016-12-05 22:59:55 -08:00
Matt Brubeck ed444b4679 Version 0.3.1 2016-12-05 17:18:54 -08:00
Matt Brubeck d4bc3c2b28 Clean up whitespace 2016-12-05 17:18:54 -08:00
Matt Brubeck c84c5e5674 Stop using deprecated std::hash::SipHasher 2016-12-05 17:18:54 -08:00
Matt Brubeck c5163a987a Make shrink-to-fit use the inline buffer when possible 2016-12-05 17:18:54 -08:00
Matt Brubeck afea0973b7 Fix a memory safety bug in SmallVec::grow 2016-12-05 17:18:54 -08:00
Matt Brubeck 5646a13bf3 Deprecate the redundant push_all_move method 2016-12-05 17:18:54 -08:00
Matt Brubeck 17380a728c Inline a bunch of stuff 2016-12-05 17:18:17 -08:00
Matt Brubeck 471de48d4f Add documentation for SmallVec and its methods 2016-12-05 17:18:17 -08:00
bors-servo b00df1368e Auto merge of #39 - servo:new, r=Ms2ger
Move `SmallVec::new` to top so it appears first in rustdoc.

<!-- 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/39)
<!-- Reviewable:end -->
2016-11-22 08:10:22 -06:00
Corey Farwell 586123eb0e Move SmallVec::new to top so it appears first in rustdoc. 2016-11-18 22:40:02 -05:00
bors-servo bd5212556a Auto merge of #38 - Marwes:deref_slice, r=jdm
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 -->
2016-10-05 11:49:36 -05:00