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
49be63d9b8
arrayvec: Reorder method pop
2016-02-17 23:08:46 +01:00
bluss
07b2ca2e1f
Edit docs for methods returning Result
2016-02-17 23:08:46 +01:00
bluss
7504f0e1a4
Fix: Display is in libcore
2016-02-07 18:48:48 +01:00
bluss
c9789f3461
Merge pull request #24 from bluss/clone_from
...
impl clone_from for ArrayVec and ArrayString
2016-02-06 20:22:40 +01:00
bluss
595db1ffcc
Add feature "std" to arrayvec: Allow opting out of libstd
2016-02-06 20:16:43 +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
Alexander Regueiro
9845491060
Added ArrayString::from constructor that takes string slice.
...
Also added corresponding test.
2016-02-05 22:30:24 +00:00
bluss
62d372ce1f
Add DerefMut for ArrayString
2016-01-13 13:01:13 +01:00
bluss
2046e3f726
Add method CapacityError::simplify
...
This is needed so that CapacityError<&str> isn't prohibitively difficult
to use. It converts to CapacityError<()>.
2016-01-13 12:55:29 +01:00
bluss
d991c17a25
ArrayString::push_str: Write capacity check in safer style
...
Use an arithmetic overflow safe conditional.
2015-12-29 12:12:42 +01:00
bluss
440bcbf66b
Add ArrayVec::dispose()
2015-12-29 12:12:42 +01:00
bluss
c73d5fa203
Implement Error trait for CapacityError
2015-09-20 13:02:08 +02:00
bluss
7b47f1e891
Use no public fields for CapacityError
2015-09-18 01:00:55 +02:00
bluss
90de29e6cb
Remove zero from the Index trait
2015-09-18 00:53:19 +02:00
bluss
6af588cb2c
ArrayString: Add PartialEq, Eq, Hash, and tests
2015-09-18 00:52:17 +02:00
Tobias Bucher
6a8fdfdedb
Make push and push_str return Results
...
The error type is called `CapacityError` and lets you extract the pushed
element.
2015-09-13 12:52:16 +01:00
bluss
10aa8245d8
ArrayString: Make Copy, don't use ArrayVec
2015-09-12 14:36:53 +02:00
Tobias Bucher
078dbf4b15
Move ArrayVec back into the main file
2015-09-12 13:22:30 +01:00
Tobias Bucher
4977da3502
Add ArrayString, which is to ArrayVec what String is to Vec
2015-09-11 14:45:09 +01:00
bluss
def1be54ed
Add test for Write
2015-09-10 19:49:37 +02:00
Tobias Bucher
98b1370e46
Add io::Write implementation akin to Vec
2015-09-10 18:35:30 +01:00
bluss
c3f2866bd3
Complete PartialOrd implementation
...
PartialOrd partialness requires all methods to be overridden to provide
consistent quirkyness with floats.
2015-09-10 15:13:26 +02:00
bluss
5b29055b5a
cleanup in insert
2015-09-10 15:10:04 +02:00
bluss
6bd31617b6
Remove redundant local
2015-09-10 15:10:04 +02:00
Tobias Bucher
1737a24e0d
Add PartialOrd and Ord implementation for ArrayVec
2015-09-10 13:51:47 +01:00
Tobias Bucher
32832aa0f2
Add Default implementation for ArrayVec
2015-09-10 13:04:30 +01:00
bluss
9afff02a69
Update doc style
...
Remove all headings in method docs
2015-08-21 15:32:55 +02:00
bluss
c35760e02c
Use NoDrop to fix panic safety issues
...
ArrayVec::drop was not panic safe — if there would be a panic during an
element's drop, the discriminant would never be set to Dropped, and the
array elements would potentially double drop.
Fix this by going back to the old NoDrop composition. The NoDrop struct
thas its own Drop impl, that will trigger too on panic during an element's
drop. This serves to make ArrayVec::drop panic safe.
Also tweak IntoIter::drop to make it panic safe: set inner ArrayVec's
length before dropping any elements.
Thank you to @Stebalien for reporting this bug and providing the
excellent testcases in this commit.
Using NoDrop expands ArrayVec to have two drop flags again, but this
is a temporary tradeoff, drop flags will eventually go away.
Fixes #3
2015-08-20 22:33:01 +02:00
root
cf273fec1f
Use a non-dropping enum directly
...
Don't use NoDrop as a separate abstraction: Then we have two drop flags,
one for ArrayVec and one for NoDrop. Instead import the logic from
NoDrop. The result is a much smaller ArrayVec value.
2015-07-30 16:14:04 +02:00
root
5c50c4dbc7
Add method .into_inner()
2015-06-22 16:35:21 +02:00
root
66d5d9a12e
Expose ArrayVec::set_len as a pub unsafe method
2015-06-22 00:17:23 +02:00
root
ad22698464
arrayvec: Use odds & bump version
2015-06-02 17:30:59 +02:00
root
6081270cf3
Order & group methods logically for docs
2015-05-25 13:46:26 +02:00
root
196a9d60b6
Move tests to tests/ directory
2015-05-25 02:35:52 +02:00
root
11a864b6f7
Add test for Option<ArrayVec<_>> to be sure
2015-05-25 02:26:32 +02:00
root
8a154e9847
Use set_len() consistently and code cleanup
2015-05-25 00:26:17 +02:00
root
3d579a626d
Improve .insert()'s removal of the last element
2015-05-23 12:53:35 +02:00
root
1eec0d4834
Make sure the methods on RangeArgument can be inlined
2015-05-23 12:43:45 +02:00
root
3175d97f80
Implement ArrayVec::clear
2015-05-23 03:12:38 +02:00
root
be2979d87a
Make sure methods in helper trait Index are inlined
2015-05-23 00:52:26 +02:00
root
37c0f53708
Add another testcase to insert
2015-05-23 00:52:26 +02:00
root
ebf260ea90
Implement ArrayVec::insert
2015-05-22 20:18:01 +02:00
root
d3b3fc16fb
Implement array sizes in the 16-bit index range
2015-05-22 20:16:41 +02:00
root
8f8db4a3ed
Implement ArrayVec::remove() and ::drain()
2015-05-22 14:22:43 +02:00
root
33e31b8ecf
Implement ArrayVec::swap_remove
2015-05-22 13:49:44 +02:00
root
1b42f992ed
Move Array trait to separate file
...
Also remove the ::new() method on the trait
2015-05-22 13:26:01 +02:00
root
00466e6efd
Simplify drop test (Rc is redundant)
2015-05-21 16:04:38 +02:00