Commit Graph

24 Commits

Author SHA1 Message Date
Conrad Ludgate 16c8e4d40d tests + docs 2021-05-29 13:01:14 +01:00
Conrad Ludgate 6dc46b3a1c update take 2021-05-26 20:08:02 +01:00
Conrad Ludgate 8778483b12 feat: API additions 2021-05-25 21:57:59 +01:00
bluss 5685049fbe 0.7.0 2021-03-29 22:10:04 +02:00
bluss b0dfc877c1 Merge pull request #183 from bluss/revert-new
Add new_const() for const construction and revert new to old version
2021-03-29 21:57:12 +02:00
bluss b7f3aa9fce FIX: Add new_const() for const construction and revert new to old version
The new() function is significantly faster, it optimizes better at the
moment/in current rust. For this reason, provide a const fn constructor,
but not as the default `new`.
2021-03-29 21:52:39 +02:00
bluss b82a6d4977 FIX: Update .retain() optimization for const generics 2021-03-29 17:43:01 +02:00
Niklas Fiekas c094906a13 Fix mutable reborrow
Co-authored-by: bluss <bluss@users.noreply.github.com>
2021-03-29 17:40:46 +02:00
Niklas Fiekas 345c6b4970 Mirror optimization of std::Vec::retain (rust-lang/rust#81126) 2021-03-29 17:40:46 +02:00
rodrimati1992 5ad4687b1b Made ArrayVec::new and ArrayString::new const fns
Added utils module with a `MaybeUninit` helper type to construct `[MaybeUninit<T>; N]`

Removed all uses of the "unstable-const-fn" feature, and documented it as being deprecated.

Changed `assert_capacity_limit` macro to work in const contexts.
2021-03-28 14:48:27 -03:00
Josh Stone dc0360ffd2 DOC: Fix typo in ArrayVec::is_full 2021-03-24 16:57:10 -07:00
bluss 0c90469b61 FEAT: Use u32 for the length field in arrayvec
Store the length as u32 internally. This is to shrink the size of the
ArrayVec value (when possible, depending on element type).

Inline storage vectors larger than u32::MAX are very unlikely to be
useful - for these cases, prefer using Vec instead.

It's not possible to have the CAP type parameter be of type u32 (missing
features in const evaluation/const generics). We also have to panic at
runtime instead of having a static assertion for capacity, for similar
reasons.
2021-03-24 18:43:09 +01:00
bluss f9f58c94b7 FIX: Use more efficient cloning in IntoIter::clone
Using .extend_from_slice() where possible.
2021-03-23 21:57:11 +01:00
bluss cf283a0ee6 FIX: Code cleanup in .into_inner()
Prefer ManuallyDrop instead of forget (more modern style preference -
with the benefit that the ManuallyDrop style sets up the non-dropping
before taking further actions).
2021-03-23 21:55:54 +01:00
bluss 74039f1b4c DOC: Doc comment and example updates for ArrayVec 2021-03-23 21:55:43 +01:00
bluss 666c5ece59 API: Remove deprecated ArrayVec::dispose 2021-03-23 21:43:19 +01:00
bluss a554ea219a API: Panic in .extend() and from_iter on capacity exceeded
This regresses performance of the .extend(s) benchmark where s is a
slice; to compensate add a private extend_from_slice method that we can
use where possible (clone_from, try_from).
2021-03-23 19:33:10 +01:00
bluss c751c2204f Remove old Array and Index traits 2021-03-23 18:22:12 +01:00
bluss 6daae9ae68 FIX: Fix serde feature for const gen 2021-03-23 18:22:12 +01:00
bluss c9b095f263 FEAT: Port ArrayString to const generics 2021-03-23 18:22:12 +01:00
bluss 5502324b6f TEST: Fix arrayvec tests for const gen
Just search/replace for syntax [T; N] -> T, N and it works.
2021-03-23 18:08:07 +01:00
bluss 02ab4dc796 FEAT: Add new const generics version of ArrayVec (first draft) 2021-03-23 18:08:07 +01:00
bluss 630b81b848 Use ArrayVecImpl in ArrayVec 2021-03-23 17:51:10 +01:00
bluss c3ef5fe840 MAINT: Move ArrayVec implementation to module 2020-12-17 22:58:27 +01:00