Also lifts the `A: Array` constraint on ArrayVec as it was not used yet
and would otherwise conflict with the const fn, which currently (Rust 1.51)
may not have any trait constraints.
Since this commit only adds a new function and lifts a constraint, this
should be perfectly backwards compatible.
* 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
* Add Array::default function to construct a default array
* Use Array::default instead of Default::default to allow supporting all array sizes
* Missed impl Array for [T; 33] 🍀
* Avoid needing `[T; N]: Default with const-generics
* 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.
* more features for fuzzing
* arrayveciter fuzzer + overflow fix
* moar fuzzers and tinyvecdrain change
* cargo fmt
* Self on enums is not stable in 1.36
* 🐞 BUGFIX: ArrayVecIterator::nth_back
* cargo fmt
* 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
* 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
* change behavior on extend_from_slice, append
* preallocation in extend()
* append v2
* obviously
* fix resize_with
* try_functions and to_vec on arrayvec
* shrink_to_fit
* bit of cleaning
* cosmetic changes
* use asserts instead of if-panics
* I promise, this is the last commit
* examples, tests
* matches macro exists since rust 1.42
* Update tinyvec.rs
* new extend and insert
* mem::take is from rust 1.40
* Make capacity() methods not rely on Array::CAPACITY
Because Array isn't an unsafe trait, unsafe code cannot depend on the
length of a slice produced by Array::as_slice to be at least as long as
Array::CAPACITY. This means that unsafe code also cannot depend on
capacity() methods that return Array::CAPACITY. Returning the result of
a slice len() call ensures that if nothing else, with a sound
implementation of Array, capacity() methods will return a valid length
for a sub-slice of the backing array.
* Add comments explaining choice against using Array::CAPACITY
* Modify tiny_vec! to avoid error on non-Copy types
Using $elem in two closures in the previous version of the macro created
errors when using types that don't implement Copy. Moving the decision
of whether to allocate or use an inline array to the macro invocation
resolves this error as the borrow checker can see that both branches are
never taken together.
* Add test for tiny_vec! using non-Copy types
* Fix inference issue
* Use full crate path in tiny_vec!
* start of slicevec
* remove todo! because it's not in 1.36
* Update Cargo.toml
* slice vec into iterator
* slicevec drain
* complete last unimplemented
* remove the extra default feature
* spelling
* Update src/slicevec.rs
Co-Authored-By: Joshua Nelson <joshua@yottadb.com>
* docs clarification.
Co-authored-by: Joshua Nelson <joshua@yottadb.com>