clubby789
c9ff579405
Fix stacked borrows violations
...
Use offsets from a single pointer instead of multiple pointers into an array.
Also removed an integer-pointer cast
2022-11-12 09:46:43 +01:00
bluss
a4690c9389
Merge pull request #194 from bhgomes/const-fns
...
Upgrade length/capacity-related functions to const-fn
2021-10-27 19:56:40 +02:00
Niklas Fiekas
bc21f19e70
Follow optimization of std::Vec::retain ( rust-lang/rust#88060 )
2021-10-08 10:38:58 +02:00
bluss
1e74077b72
Doc/wording edit for zero_filled
2021-08-14 13:37:00 +02:00
Caio
f5acafa0b3
Add zero_filled constructor
2021-08-13 20:04:44 -03:00
Brandon H. Gomes
17c5dd051e
upgrade len/capacity-related functions to const-fn
2021-08-01 13:54:17 -04:00
Brandon H. Gomes
481f93084e
add remaining_capacity to ArrayString
2021-08-01 13:53:21 -04:00
ltdk
c4917813b8
Add ArrayString::as_mut_str
2021-06-20 15:35:54 -04:00
bluss
0c866b32f0
0.7.1
2021-06-05 15:13:37 +02:00
bluss
515a18cc88
Merge pull request #187 from conradludgate/into-inner-take
...
take and into_inner_unchecked functions
2021-05-31 23:43:55 +02:00
Conrad Ludgate
0fdf39f15d
debug-assert
2021-05-30 20:34:17 +01:00
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
Benoît du Garreau
6be5ed4bc2
Use truncate in clone_from
2021-05-24 22:09:34 +02: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
bluss
57e140065f
FIX: Minor code style change in the char module
...
Just use the simple inherent pointer methods here.
2021-03-29 17:31:37 +02:00
bluss
b24baf1b5d
DOC: Tweak formatting and wording of unstable-const-fn feature
2021-03-28 22:47:22 +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
Jacob Kiesel
0bc7ffc9fd
Minor fix to macro definition
2021-03-26 12:34:16 -06:00
Josh Stone
dc0360ffd2
DOC: Fix typo in ArrayVec::is_full
2021-03-24 16:57:10 -07:00
bluss
fd724e0edb
DOC: Minor tweaks to docs
2021-03-24 18:43:09 +01: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
d273861cde
DOC: Update MSRV doc to Rust 1.51
2021-03-23 18:22:12 +01:00
bluss
c751c2204f
Remove old Array and Index traits
2021-03-23 18:22:12 +01:00
bluss
f2e9378fd6
FIX: Fix unstable-const-fn feature
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
a2b2efd379
Add ArrayvecImpl, base implementation of 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
bluss
5ef684920d
MAINT: Fix doc link in crate
2020-12-17 22:56:23 +01:00
Caio
6dccb480f7
Impl TryFrom<fmt::Arguments<'a>> for ArrayString
...
Shortcut for
```
use fmt::Write;
let mut v = Self::new();
v.write_fmt(f).map_err(|e| CapacityError::new(e))?;
```
2020-12-09 20:21:03 -03:00
bluss
0acbba4ceb
Merge pull request #165 from c410-f3r/try
...
impl TryFrom<&'a str> for ArrayString
2020-12-01 02:22:36 +01:00
bluss
50c9ed1abd
Merge pull request #166 from hbina/use_add_instead_of_offset
...
Use `add` instead of `offset` so we don't need to cast to isize.
2020-10-23 18:13:41 +02:00
Hanif Bin Ariffin
92867bb118
Use add instead of offset to avoid casting to isize.
2020-10-21 20:50:00 +08:00
Caio
2267276dbb
impl TryFrom<&'a str> for ArrayString
2020-08-28 08:16:20 -03:00
Mara Bos
fe70c23e94
Add unstable-const-fn feature to make new() functions const.
2020-06-30 20:56:00 +02:00