Commit Graph

94 Commits

Author SHA1 Message Date
bluss a59b5c0b86 DOC: Rust version in docs
Required rust version should be in rustdoc

Reason: Written in one or a few places. Information is versioned with
the crate on docs.rs
2017-07-30 14:14:25 +02:00
bluss 1d08021107 BUG: Fix serde code for push change 2017-07-30 14:12:24 +02:00
bluss da62042001 FEAT: Make swap_remove return the element, add try_swap_remove for fallible 2017-07-30 13:18:50 +02:00
bluss 98af43cf9c FEAT: Make .push() use panics for errors, add .try_push() 2017-07-30 13:14:22 +02:00
bluss dadeedb787 FEAT: Proper Error impls for errors
Also use pub(crate), requiring Rust 1.18
2017-07-30 13:13:52 +02:00
bluss 79ccdcd910 FEAT: Copy RangeArgument from crate odds
This means odds is no longer a public dependency, which simplifies the
version story for arrayvec
2017-07-30 13:00:53 +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
David Ross 704f237282 Remove ambiguities in serde expecting messages. 2017-06-14 21:55:57 -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
Niklas Fiekas 12eee0677c Debug assert capacity in push_unchecked() 2017-05-24 21:16:27 +02:00
Niklas Fiekas 1b6e0a3bfb Use push_unchecked() for Extend 2017-05-13 23:51:17 +02:00
Niklas Fiekas d0ebfcd51f Factor out push_unchecked() 2017-05-13 23:51:17 +02:00
Tobias Bucher 0c8f46796e Add PartialOrd and Ord implementation to ArrayString
Fixes #50.
2017-04-22 16:31:41 +02: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 3d69403dee Use encode_utf8 from crate odds 2016-10-16 11:54:44 +02:00
bluss d43c959fa8 0.3.20 2016-10-04 14:47:14 +02: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 f331bb1228 0.3.19 2016-09-28 11:13:15 +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 8785860ec4 arrayvec 0.3.17 2016-09-08 11:46:01 +02:00
Jake Goulding b0bf84b201 Add is_full predicate methods 2016-05-28 10:03:54 -04:00
bluss 8d30739409 Add .as_slice(), .as_mut_slice(), .as_str()
Vec and String now have these, so we do too to follow convention.
2016-02-29 23:53:52 +01: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 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