Ralf Jung
b7fd8d6a22
enable another unwinding test in Miri
2019-12-07 12:13:31 +01:00
Ralf Jung
9ed6941a51
run miri on CI
2019-11-16 09:52:18 +01:00
bluss
abf1bb5a0a
TEST: Update .travis for serde-1 to serde rename
2019-09-25 14:46:32 +02:00
bluss
ba4d98c5c7
TEST: Update tests for passing without std feature
2019-09-25 14:37:06 +02:00
bluss
aece292b6c
API: Use RangeBounds for .drain()'s range argument
2019-09-17 21:33:32 +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
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
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
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
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
94ab27a649
Merge branch '0.4' of https://github.com/bluss/arrayvec into merge-0.4
...
* '0.4' of https://github.com/bluss/arrayvec :
0.4.9
TEST: Add test that ensures the MaybeUninit impl is used on nightly
FIX: Remove use of uninitialized in ArrayString
FEAT: Implement a "MaybeUninit" and use it conditionally
TEST: Add test that Some(ArrayVec<[&_;_]>).is_some()
MAINT: Test the 0.4 branch in travis
2018-12-16 18:09:20 +01:00
bluss
f0ec3e1398
TEST: Add test that ensures the MaybeUninit impl is used on nightly
2018-12-16 10:46:38 +01:00
bluss
8f8617b967
TEST: Add test that Some(ArrayVec<[&_;_]>).is_some()
...
This seems like a trivial test, but since it can fail, it shows us that
we don't have a sound implementation yet.
2018-12-15 14:47:19 +01:00
bluss
226de4c9ba
TEST: Add test for try_extend_from_slice's error
2018-11-30 18:48:43 +01:00
bluss
47827e4843
FIX: Remake extend_from_slice to try_extend_from_slice
...
Do nothing and return an error, if the slice doesn't fit in the
remaining capacity.
2018-11-28 15:59:11 +01:00
bluss
8e5ff2d0fb
FIX: Rename ArrayVec .capacity_left() → .remaining_capacity()
2018-11-28 15:52:46 +01:00
Thomas de Zeeuw
2120e4bb75
FEAT: Add ArrayVec.extend_from_slice
2018-11-26 12:59:30 +01:00
Thomas de Zeeuw
d11c853346
FEAT: Add ArrayVec.capacity_left
2018-11-26 12:59:30 +01:00
bluss
233df73ab2
Merge pull request #98 from bluss/use-drop-in-place
...
Use drop_in_place for truncate and clear (and drop)
2018-11-25 10:40:17 +01:00
bluss
74f86a710e
Merge branch 'master' into master
2018-11-25 10:29:22 +01:00
bluss
d77b93079f
TEST: Add minimal tests for new array sizes
2018-11-25 09:36:22 +01:00
Clar Fon
2d3c2e3a0f
Test IntoIter::clone
2018-10-28 18:45:11 -04:00
Clar Charr
55bedc922a
Make zero-capacity ArrayVec a zero-sized type.
2018-10-14 17:25:45 -04:00
bluss
ac61ce748b
TEST: Fix drop tests for older Rust
...
In the test, test with Vec first to see how Rust implements panic
recovery while elements drop. If Vec drops all the elements, then we
test that arrayvec does too.
2018-03-25 23:49:42 +02:00
bluss
3f9cdc52cd
TEST: Add test that we drop all elements even if one of them panics
2018-03-25 23:26:20 +02:00
Tobias Bucher
9d0f801763
Add Default implementation for ArrayString
...
Fixes #67 .
2017-09-11 19:59:06 +02:00
bluss
2de36ba2ca
Add 65536 to the Array impls
2017-08-06 18:44:48 +02:00
bluss
313ebe8335
FEAT: Rename .remove_opt() to .pop_at()
2017-08-05 18:22:06 +02:00
bluss
cf76a83a7f
BUG: Fix import of CapacityError in tests
2017-08-05 18:21:43 +02:00
bluss
bc9e0362bd
FEAT: Remove InsertError again
...
try_insert has a capacity error, but panics if the index is out of
bounds.
2017-08-05 17:40:12 +02:00
bluss
1e83039426
FEAT: Align ArrayString .push and .push_str with String
...
Use same signatures (meaning: panics on errors). Add fallible versions
.try_push() and .try_push_str()
2017-07-30 15:38:42 +02:00
bluss
345dd33942
FEAT: Refactor errors. Insert is either out of bounds or capacity error
2017-07-30 15:12:03 +02:00
bluss
98af43cf9c
FEAT: Make .push() use panics for errors, add .try_push()
2017-07-30 13:14:22 +02:00
bluss
5dcb5ab2c7
FEAT: Change .insert() and .remove() to match Vec
...
- Add try_insert / try_remove to be the old fallible variants that
return errors
- Insert that pushes out if full does no longer exist -- full vec is an
error
2017-07-30 12:57:28 +02:00
bluss
29497206da
Merge pull request #55 from daboross/serde
...
Add serde support
2017-07-30 12:15:38 +02:00
bluss
28b2543ae0
Remove failing test (with optimizations)
...
What the test was doing was simply UB and we can't expect rustc to make
sense of it. The test was failing with optimizations on, yet a closer look
says arrayvec is still working as it should. So remove the broken test.
2017-07-29 12:38:50 +02:00
David Ross
6cd03dce8d
Add failure tests for serde implementations
...
Thanks to @camlorn for the idea.
2017-06-16 15:09:48 -07:00
David Ross
1b0168bb6f
Change feature name from 'serde' to 'serde-1'.
2017-06-08 12:02:21 -07:00
David Ross
21cd20ff26
Add 'serde' feature for serializing and deserializing ArrayVec and ArrayString.
...
This implements serde support under the optional 'serde' feature, and adds unit tests to test said support.
https://serde.rs/unit-testing.html used as a guide for the unit tests - using 'serde_test' makes for much
less boilerplate here, but it does require that the project have a non-optional dev dependency on 'serde_test'.
2017-06-08 01:42:34 -07:00
bluss
f65ea92da4
Remove the optional generic-array feature
...
- It can be added back later if needed
- A public dependency implies version coupling, and we can't afford to
have it for a niche use case.
2017-03-24 18:57:39 +01:00
bluss
da459bcf78
Add constructor ArrayString::from_byte_string(b"abc")
...
This is an alternative constructor that never has capacity errors.
Unfortunately the error case is invalid UTF-8!
2016-12-14 15:01:17 +01:00
bluss
7a7ec178b9
Fix ArrayString to implement .push(char) faster
...
Previously we used formatting, which is a virtual call and quite the
detour. Now copy the utf-8 encoding code from Rust (thank you Alex
Crichton) and use that.
2016-10-04 14:40:33 +02:00
bluss
60a97632bc
Support generic-array as arrayvec backend
2016-09-28 11:06:20 +02:00
bluss
2a1378d3eb
Fix bounds checking in ArrayVec::insert(index, element)
...
Must be `index <= len && index < capacity`
2016-09-21 14:21:07 +02:00
bluss
c5589aecdf
Add .retain() method
...
Based on "retain_mut" as discussed for vec: we can provide &mut to the
element to remove effortlessly.
2016-02-18 00:34:40 +01:00
bluss
a17c764f98
impl clone_from for ArrayVec and ArrayString
2016-02-06 15:22:27 +01:00
bluss
9fdb7dd631
Fixup indentation
2016-02-06 00:59:37 +01:00
Alexander Regueiro
0a413975f5
Re-added accidentally removed test method.
...
Also fixed indentation.
2016-02-05 22:56:44 +00:00