Commit Graph

14 Commits

Author SHA1 Message Date
Lokathor 71bc7f110b improve clone impl as per https://github.com/Lokathor/tinyvec/issues/143 (#144)
* improve clone impl as per https://github.com/Lokathor/tinyvec/issues/143

* per https://github.com/Lokathor/tinyvec/pull/144#discussion_r669769122

* rustfmt.

* formatting

* whoops haha that's a little tricky to get the types to line up

we don't have deref for the A so we have to keep using as_slice_mut and such
2021-07-21 18:11:46 -06:00
Soveu d508e914f7 TinyVec::fmt - fix pretty printing (#138)
* TinyVec::fmt - fix pretty printing

* ArrayVec::fmt - fix pretty printing
2021-03-24 11:55:02 -06:00
Michael Morgan af1817d770 Add TryFrom<&'_ [A::Item]> for ArrayVec<A> (#134) 2021-03-01 20:02:24 -07:00
SlightlyOutOfPhase 59a2b4c903 Implement [value; N] syntax support for array_vec! (#118)
* Implement `[value; N]` syntax for `array_vec!`

Also implement the `($array_type:ty)` form by just calling `default()` immediately, which makes more sense.

* Add tests for `[value; N]` macro form

* Implement `[value; N]` syntax for `tiny_vec!`

Also make the same improvement to the `($array_type:ty)` macro variant that I did for `array_vec!`.

* Add tests for `[value; N]` macro form
2020-10-11 18:42:51 -06:00
aspen 1dbf6bfe73 Add Serde support (#110)
* Add Serde support.

* Removes `serde/alloc` from deps( tests still pass without it anyways)

* Fix some issues that could result in a panic.

* Wait, actually use the size_hint properly.

* Error instead of silent truncation.

* That wasn't meant to be a default feature.
2020-08-17 07:39:29 -06:00
Soveu 78eac4ff84 Change len type from usize to u16 (#97)
* change len from usize to u16

* cargo fmt

* change len to tail
2020-07-31 13:46:05 -06:00
Soveu 820dbc4c85 A bit of everything for iterators (#87)
* slight changes functions that use drain

* bug in arrayvec iter

* reverse iter for arrayvec

* nth_back is stable since 1.37

* simpler drain for arrayvec

* soveu forgot to add changed files

* fmt + feature for rustc >= 1.40

* cosmetic changes

* does the ci work now?

* SHNAAAAAAAAATSEEEEEEEEL
2020-07-23 13:28:01 -06:00
Benjamin Scherer 04f65e50cf Add ArrayVec::splice and TinyVec::splice (#85)
* Add ArrayVec::splice and TinyVec::splice

Added for closer API parity with std::Vec

* Fix ArrayVec::splice example typo

* Removed FusedIterator bound from splice

This bound could've caused confusing error messages, and was
inconsistent with the Vec API. splice now uses fuse itself to ensure
consistency. Vec::splice consumes the whole iterator at once, so it
essentially has the same behavior, but this implementation gradually
consumes the iterator as elements are drained, so this fuse is necessary
to keep the behavior the same.

* Reserve additional capacity in TinyVecSplice

Used TinyVec::reserve to pre-allocate space for elements being spliced
into the TinyVec after the splicing iterator is dropped. Used the lower
bound like Vec's splice does.

* Run rustfmt
2020-07-18 00:22:59 -06:00
Lokathor 5bb7c7585b Closes https://github.com/Lokathor/tinyvec/issues/75 (#77)
* Closes https://github.com/Lokathor/tinyvec/issues/75

* This is a breaking change to the macro

* benchmarks fixes.

* slim down to just `take`
2020-07-03 10:56:45 -06:00
Josh Stone d04abff44c impl IntoIterator for &/&mut ArrayVec (#69)
These just create slice iterators, but the impls are useful to have for
contexts that don't auto-deref, as in the new tests.
2020-03-31 13:36:39 -06:00
Lokathor 032ac155c9 cargo fmt hasn't been used in a while it seems. 2020-01-19 13:02:54 -07:00
Andreas Molzer fd28ecb105 Test and fix removal at past-the-end index 2020-01-18 13:24:58 +01:00
Lokathor b2c3141a6a more docs, more renames, closer to being good. 2020-01-13 21:34:22 -07:00
Lokathor c74c1e3785 rename arrayish to array I guess
The "ish" part was always supposed to be temporary.
2020-01-13 21:12:04 -07:00