about summary refs log tree commit diff
path: root/library/alloc/src/collections/vec_deque
AgeCommit message (Collapse)AuthorLines
2021-10-10Add #[must_use] to alloc constructorsJohn Kugelman-0/+2
2021-10-06Rollup merge of #89245 - DeveloperC286:iter_mut_fields_to_private, ↵Manish Goregaokar-16/+21
r=joshtriplett refactor: make VecDeque's IterMut fields module-private, not just crate-private Made the fields of VecDeque's IterMut private by creating a IterMut::new(...) function to create a new instance of IterMut and migrating usage to use IterMut::new(...).
2021-10-05refactor: VecDeques IterMut fields to privateDeveloperC-16/+21
Made the fields of VecDeque's IterMut private by creating a IterMut::new(...) function to create a new instance of IterMut and migrating usage to use IterMut::new(...).
2021-10-05refactor: VecDeques Drain fields to privateDeveloperC286-17/+26
2021-10-04Rollup merge of #89244 - DeveloperC286:pair_slices_fields_to_private, ↵Manish Goregaokar-4/+4
r=joshtriplett refactor: VecDeques PairSlices fields to private Reducing VecDeque's PairSlices fields to private, a `from(...)` method is already used to create PairSlices.
2021-10-04Rollup merge of #87993 - kornelski:try_reserve_stable, r=joshtriplettJubilee-4/+2
Stabilize try_reserve Stabilization PR for the [`try_reserve` feature](https://github.com/rust-lang/rust/issues/48043#issuecomment-898040475).
2021-10-04Rollup merge of #88452 - xu-cheng:vecdeque-from-array, r=m-ou-seJubilee-1/+41
VecDeque: improve performance for From<[T; N]> Create `VecDeque` directly from the array instead of inserting items one-by-one. Benchmark ``` ./x.py bench library/alloc --test-args vec_deque::bench_from_array_1000 ``` * Before ``` test vec_deque::bench_from_array_1000 ... bench: 3,991 ns/iter (+/- 717) ``` * After ``` test vec_deque::bench_from_array_1000 ... bench: 268 ns/iter (+/- 37) ```
2021-10-04Stabilize try_reserveKornel-4/+2
2021-10-02Make diangostic item names consistentCameron Steffen-1/+1
2021-09-26Auto merge of #89144 - sexxi-goose:insig_stdlib, r=nikomatsakisbors-0/+1
2229: Mark insignificant dtor in stdlib I looked at all public [stdlib Drop implementations](https://doc.rust-lang.org/stable/std/ops/trait.Drop.html#implementors) and categorized them into Insigificant/Maybe/Significant Drop. Reasons are noted here: https://docs.google.com/spreadsheets/d/19edb9r5lo2UqMrCOVjV0fwcSdS-R7qvKNL76q7tO8VA/edit#gid=1838773501 One thing missing from this PR is tagging HashMap as insigificant destructor as that needs some discussion. r? `@Mark-Simulacrum` cc `@nikomatsakis`
2021-09-25Rollup merge of #89010 - est31:intra_doc_links, r=m-ou-seManish Goregaokar-1/+2
Add some intra doc links
2021-09-25refactor: VecDeques PairSlices fields to privateDeveloperC-4/+4
2021-09-22PR fixupAman Arora-1/+1
2021-09-212229: Annotate stdlib with insignficant dtorsAman Arora-0/+1
2021-09-17refactor: VecDeques IntoIter fields to privateDeveloperC286-2/+8
2021-09-16Add IntoIterator intra doc link to various collectionsest31-1/+2
2021-08-28VecDeque: improve performance for From<[T; N]>Cheng XU-1/+41
Create VecDeque directly from the array instead of inserting items one-by-one.
2021-08-16Remove extra empty linesXuanwo-2/+0
Signed-off-by: Xuanwo <github@xuanwo.io>
2021-08-16Optimize unnecessary check in VecDeque::retainXuanwo-8/+59
Signed-off-by: Xuanwo <github@xuanwo.io>
2021-08-08Auto merge of #86879 - YohDeadfall:stabilize-vec-shrink-to, r=dtolnaybors-2/+1
Stabilize Vec<T>::shrink_to This PR stabilizes `shrink_to` feature and closes the corresponding issue. The second point was addressed already, and no `panic!` should occur. Closes #56431.
2021-08-08Bump shrink_to stabilization to Rust 1.56David Tolnay-1/+1
2021-08-07Auto merge of #87408 - kornelski:try_reserve_error, r=yaahcbors-1/+2
Hide allocator details from TryReserveError I think there's [no need for TryReserveError to carry detailed information](https://github.com/rust-lang/rust/issues/48043#issuecomment-825139280), but I wouldn't want that issue to delay stabilization of the `try_reserve` feature. So I'm proposing to stabilize `try_reserve` with a `TryReserveError` as an opaque structure, and if needed, expose error details later. This PR moves the `enum` to an unstable inner `TryReserveErrorKind` that lives under a separate feature flag. `TryReserveErrorKind` could possibly be left as an implementation detail forever, and the `TryReserveError` get methods such as `allocation_size() -> Option<usize>` or `layout() -> Option<Layout>` instead, or the details could be dropped completely to make try-reserve errors just a unit struct, and thus smaller and cheaper.
2021-08-05alloc: Use intra doc links for the reserve functionest31-1/+3
The sentence exists to highlight the existence of a performance footgun of repeated calls of the reserve_exact function.
2021-07-30Rollup merge of #87574 - cuviper:retain-examples, r=joshtriplettYuki Okushi-3/+4
Update the examples in `String` and `VecDeque::retain` The examples added in #60396 used a "clever" post-increment hack, unrelated to the actual point of the examples. That hack was found [confusing] in the users forum, and #81811 already changed the `Vec` example to use a more direct iterator. This commit changes `String` and `VecDeque` in the same way for consistency. [confusing]: https://users.rust-lang.org/t/help-understand-strange-expression/62858
2021-07-28Update the examples in `String` and `VecDeque::retain`Josh Stone-3/+4
The examples added in #60396 used a "clever" post-increment hack, unrelated to the actual point of the examples. That hack was found [confusing] in the users forum, and #81811 already changed the `Vec` example to use a more direct iterator. This commit changes `String` and `VecDeque` in the same way for consistency. [confusing]: https://users.rust-lang.org/t/help-understand-strange-expression/62858
2021-07-28Remove redundant bounds on get_unchecked for vec_deque iterators, and run fmtFrank Steffahn-10/+4
2021-07-28Add TrustedRandomAccessNoCoerce supertrait without requirements or ↵Frank Steffahn-4/+12
guarantees about subtype coercions Update all the TrustedRandomAccess impls to also implement the new supertrait
2021-07-25Auto merge of #86595 - a1phyr:allocator_api_for_vecdeque, r=Amanieubors-74/+137
Add support for custom allocator in `VecDeque` This follows the [roadmap](https://github.com/rust-lang/wg-allocators/issues/7) of the allocator WG to add custom allocators to collections. `@rustbot` modify labels: +A-allocators +T-libs
2021-07-24Auto merge of #84111 - bstrie:hashfrom, r=joshtriplettbors-0/+22
Stabilize `impl From<[(K, V); N]> for HashMap` (and friends) In addition to allowing HashMap to participate in Into/From conversion, this adds the long-requested ability to use constructor-like syntax for initializing a HashMap: ```rust let map = HashMap::from([ (1, 2), (3, 4), (5, 6) ]); ``` This addition is highly motivated by existing precedence, e.g. it is already possible to similarly construct a Vec from a fixed-size array: ```rust let vec = Vec::from([1, 2, 3]); ``` ...and it is already possible to collect a Vec of tuples into a HashMap (and vice-versa): ```rust let vec = Vec::from([(1, 2)]); let map: HashMap<_, _> = vec.into_iter().collect(); let vec: Vec<(_, _)> = map.into_iter().collect(); ``` ...and of course it is likewise possible to collect a fixed-size array of tuples into a HashMap ([but not vice-versa just yet](https://github.com/rust-lang/rust/issues/81615)): ```rust let arr = [(1, 2)]; let map: HashMap<_, _> = std::array::IntoIter::new(arr).collect(); ``` Therefore this addition seems like a no-brainer. As for any impl, this would be insta-stable.
2021-07-24Hide allocator details from TryReserveErrorKornel-1/+2
2021-07-24Update std_collections_from_array stability versionbstrie-1/+1
2021-07-23Add `#[unstable]` on new functionsBenoît du Garreau-2/+2
2021-07-23Add unstable attribute for `A` in `Drain` and `IntoIter`Benoît du Garreau-2/+9
2021-07-23Add support for custom allocator in `VecDeque`Benoît du Garreau-74/+130
2021-07-21Remove unsound TrustedRandomAccess implementationsFrank Steffahn-29/+1
Removes the implementations that depend on the user-definable trait `Copy`. Only fix regressions to ensure merge in 1.55: Does not modify `vec::IntoIter`.
2021-07-06Stabilize Vec<T>::shrink_toYoh Deadfall-2/+1
2021-06-30impl From<[(K, V); N]> for std::collectionsbstrie-0/+22
2021-06-30Remove "length" doc aliasesAmanieu d'Antras-1/+0
2021-06-16Add doc(hidden) to all __iterator_get_uncheckedJacob Hoffman-Andrews-0/+3
This method on the Iterator trait is doc(hidden), and about half of implementations were doc(hidden). This adds the attribute to the remaining implementations.
2021-06-06Rollup merge of #85930 - mominul:array_into_iter, r=m-ou-seYuki Okushi-2/+1
Update standard library for IntoIterator implementation of arrays This PR partially resolves issue #84513 of updating the standard library part. I haven't found any remaining doctest examples which are using iterators over e.g. &i32 instead of just i32 in the standard library. Can anyone point me to them if there's remaining any? Thanks! r? ```@m-ou-se```
2021-06-02Stabilize VecDeque::partition_point.Mara Bos-2/+1
2021-06-02Bump vecdeque_binary_search stabilization to 1.54.Mara Bos-3/+3
2021-06-02Bumped `vecdeque_binary_search` stabilization version to 1.53.0SOFe-3/+3
2021-06-02Stabilize `vecdeque_binary_search`SOFe-7/+3
2021-06-02Replace IntoIter::new with IntoIterator::into_iter in stdMuhammad Mominul Huque-2/+1
2021-05-06Perf Experiment: Wait, what if I just skip the trait aliasScott McMurray-3/+3
2021-05-06Bootstrapping preparation for the libraryScott McMurray-3/+3
Since just `ops::Try` will need to change meaning.
2021-04-15VecDeque: Improve doc comments in binary search fnsVojtech Kral-5/+23
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2021-04-15VecDeque: Add partition_point() #78021Vojtech Kral-0/+45
2021-04-15VecDeque: binary_search_by(): return right away if hit found at back.first() ↵Vojtech Kral-1/+4
#78021