530 Commits

Author SHA1 Message Date
bluss f665142854 FEAT: Add ArrayString::len
This method is no new feature, but it saves us from going through deref
to str to fetch the length.
2019-10-09 12:21:25 +02:00
bluss 05667bb860 MAINT: Add debug info to profiles (for bench/profiling) 2019-10-09 12:21:25 +02:00
bluss b7b8cf8777 Merge pull request #137 from bluss/various
Combined fixes: Adjust inlining, and Fix usage of `get_unchecked_mut`.
2019-10-09 10:47:21 +02:00
bluss fd72321191 FIX: Replace uses of <[T]>::get_unchecked_mut with raw pointer accessor
This is a soundness fix w.r.t unsafe coding guidelines.

In some of the instances, `get_unchecked_mut() -> &mut T as *mut T` was
used in places where the element was potentially uninitialized.

This was a problem in push. (Not a problem in IntoIter next/next_back,
where the whole range we're iterating is initialized).
2019-10-09 10:09:07 +02:00
bluss 1483c6d372 FIX: Adjust (mostly remove) inline directives
Using the following principles:

- Trivial methods (empty and simple constants) can be inline(always)
- Generic methods don't need any inlining directive at all.
  ..with the exception of Deref which just seems to be extra important.
- Non-generic items use #[inline] to enable inlining at the
  compiler's discretion.
2019-10-09 10:02:20 +02:00
bluss bf64376f91 API: Deprecate .dispose(), it no longer has a purpose without nodrop 2019-10-09 09:39:49 +02:00
bluss 2a376d966d Merge branch 'nodrop-updates' 2019-10-09 09:34:43 +02:00
bluss c110696a96 nodrop, nodrop-union: Mark deprecated
With the release of arrayvec 0.5, these crates are unused.

With the release of Rust 1.36 and MaybeUninit, these crates have no
purpose (but for older Rust releases).
2019-10-09 09:33:13 +02:00
bluss 58eee6aea5 Merge pull request #136 from tbu-/pr_asptr
Add `as_{,mut_}ptr` functions to `ArrayVec`, mirroring `Vec`
2019-10-05 21:11:11 +02:00
Tobias Bucher 516f1511f6 Add as_{,mut_}ptr functions to ArrayVec, mirroring Vec
Fixes #135.
2019-10-05 21:01:58 +02:00
bluss 8c3634ae9e Merge pull request #133 from mathstuf/target-as-symlink
gitignore: ignore target as a symlink
2019-10-04 21:20:43 +02:00
Ben Boeckel 84b5a04522 gitignore: ignore target as a symlink 2019-10-01 19:16:39 -04:00
bluss 87ad71366c DOC: Update README 2019-09-25 15:15:43 +02:00
bluss ea591bc2de 0.5.0 2019-09-25 15:13:50 +02:00
bluss 70a9ad67af DOC: Copyedit the Array doc comment again 2019-09-25 14:48:16 +02:00
bluss abf1bb5a0a TEST: Update .travis for serde-1 to serde rename 2019-09-25 14:46:32 +02:00
bluss 46ba20ed38 DOC: Update Readme for 0.5 2019-09-25 14:45:35 +02:00
bluss babae41d21 DOC: Add safety documentation on Array trait 2019-09-25 14:43:21 +02:00
bluss ba4d98c5c7 TEST: Update tests for passing without std feature 2019-09-25 14:37:06 +02:00
bluss cac792e633 API: Rename feature flag serde-1 to serde
(Old concerns don't matter anymore, especially with renamed deps.)
2019-09-25 14:34:08 +02:00
bluss 8c3dfbc2b8 Merge pull request #132 from bluss/range-bounds
Use RangeBounds for .drain()'s range argument
2019-09-17 22:13:08 +02:00
bluss 75a6fcdc17 Merge pull request #131 from bluss/rust-2018
Update to Rust 2018
2019-09-17 21:34:09 +02:00
bluss aece292b6c API: Use RangeBounds for .drain()'s range argument 2019-09-17 21:33:32 +02:00
bluss 062247818a FIX: Remove unused cfg variable 2019-09-02 22:08:00 +02:00
bluss e86a32d454 MAINT: Port to Rust 2018 edition 2019-09-02 22:07:30 +02:00
bluss f952e2c788 MAINT: Use ? operator instead of try!() macro 2019-09-02 22:06:20 +02:00
bluss c7424b8113 Merge pull request #129 from bluss/prepare-0.5
Always use MaybeUninit and stop using nodrop fallback, prepare next release
2019-09-02 22:03:33 +02:00
bluss 470cfd2a48 FIX: Update serde impls for Array changes 2019-09-01 14:48:14 +02:00
bluss 7c33afb3ae DOC: Update min rust version to Rust 1.36 for MaybeUninit 2019-09-01 14:48:14 +02:00
bluss 8093e8d886 FEAT: Switch to using MaybeUninit for everything
Use std::mem::MaybeUninit and stop using nodrop as a fallback.
This means we require Rust 1.36
2019-09-01 14:48:14 +02:00
bluss ba94336265 DOC: Draft release note for 0.5 2019-09-01 14:47:44 +02:00
bluss f2aad9f9a7 API: Update ArrayExt's methods to expose slices instead of pointers
This is a nicer and simpler interface to expose, since the ref to uninit
array to pointer cast is not usable anyway (it's historic now, arrayvec
itself does not use it anymore).
2019-09-01 14:47:44 +02:00
bluss 6ed5b7b67f Merge pull request #130 from bluss/fix-extend-zst
Fix .extend() for arrays of zero-sized type elements
2019-09-01 14:30:54 +02:00
bluss 2a3397995d FIX: Fix .extend() for ArrayVec with zero-sized type elements
The raw pointer walk did not do the right thing for ZST, because when
offsets are zero, the start and end pointer would be the same and the
loop ends before incrementing the length correctly.
2019-09-01 14:07:58 +02:00
bluss f7381fa699 TEST: Add test for extending array of ZST
This demonstrates a bug in current extend.
2019-09-01 13:41:30 +02:00
bluss e68c0c7b48 Merge branch '0.4' into master
* 0.4:
  0.4.11
  TEST: Update tests for new MaybeUninit usage
  FEAT: Use stable MaybeUninit when we can (feature detected)
2019-07-10 17:51:59 +02:00
bluss 9792502792 0.4.11 2019-07-10 17:24:40 +02:00
bluss c155b400eb Merge pull request #127 from bluss/stable-maybe-uninit
Use stable MaybeUninit when we can (feature detected)
2019-07-10 17:21:15 +02:00
bluss 93220e55ae TEST: Update tests for new MaybeUninit usage
(Also remove the size check since we can't rely on it, even if we want
to ensure it has no overhead for the bytes case.)
2019-07-10 16:58:11 +02:00
bluss b56c3b78d0 FEAT: Use stable MaybeUninit when we can (feature detected) 2019-07-10 16:40:50 +02:00
Tobias Bucher 76e89544a5 Merge pull request #124 from seanchen1991/master
Add semicolon to return statement for consistency
2019-06-21 02:24:36 +02:00
Tobias Bucher 9932ced043 Merge pull request #121 from badboy/patch-1
Fix word duplication in docs
2019-06-21 02:24:20 +02:00
Sean Chen aab420b2ec Add semicolon to return statement for consistency 2019-06-20 14:36:13 -07:00
Jan-Erik Rediger 841ca1492b Fix word duplication in docs 2019-04-22 14:29:08 +02:00
bluss fd4a6469b9 Merge pull request #117 from despawnerer/add-fromstr-implementation
Implement FromStr for ArrayString
2018-12-23 23:42:07 +01:00
Aleksei Voronov 9207e7442f Implement FromStr for ArrayString
This is very useful for generic code that may want to parse arbitrary
input string into arbitrary other types.

Limitations of the FromStr trait don't allow us to keep the original string slice
inside the CapacityError, unfortunately.
2018-12-23 12:50:29 +01:00
bluss cffdb4602a Merge branch '0.4' of https://github.com/bluss/arrayvec
* '0.4' of https://github.com/bluss/arrayvec:
  0.4.10
  FIX: Remove unused Copy/Clone for MaybeUninit
  FIX: Use repr(C) MaybeUninit after discussion with RalfJung
2018-12-22 20:05:42 +01:00
bluss 21661facf8 0.4.10 2018-12-22 20:04:03 +01:00
bluss 06930d27ce FIX: Remove unused Copy/Clone for MaybeUninit 2018-12-22 19:59:32 +01:00
bluss 9fc6737e1b FIX: Use repr(C) MaybeUninitCopy after discussion with RalfJung
We have a recommendation from the unsafe-wg (no rule yet), that
repr(C) for unions should work this way, so that we can cast from the
union type to one of its fields.
2018-12-22 14:28:20 +01:00