about summary refs log tree commit diff
path: root/src/liballoc/collections/vec_deque.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-3117/+0
2020-07-26Auto merge of #74060 - kpp:remove_length_at_most_32, r=dtolnaybors-4/+3
Remove trait LengthAtMost32 This is a continuation of https://github.com/rust-lang/rust/pull/74026 preserving the original burrbull's commit. I talked to @burrbull, he suggested me to finish his PR.
2020-07-20Auto merge of #74010 - pierwill:pierwill-o-notation, r=GuillaumeGomezbors-8/+8
Use italics for O notation In documentation, I think it makes sense to italicize O notation (*O(n)*) as opposed to using back-ticks (`O(n)`). Visually, back-ticks focus the reader on the literal characters being used, making them ideal for representing code. Using italics, as far I can tell, more closely follows typographic conventions in mathematics and computer science. Just a suggestion, of course! 😇
2020-07-19Use italics for O notationpierwill-8/+8
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2020-07-10Add tracking issueJon Gjengset-2/+2
2020-07-06fixupsJon Gjengset-1/+5
2020-07-06Add VecDeque::range* methodsJon Gjengset-13/+99
This patch adds `VecDeque::range` and `VecDeque::range_mut` to provide iterators over a sub-range of a `VecDeque`. This behavior can be emulated with `skip` and `take`, but directly providing a `Range` is more ergonomic. This also partially makes up for `VecDeque`'s lack of `SliceIndex` support.
2020-07-05Remove the usage of the LengthAtMost32 traitRoman Proskuryakov-4/+3
2020-06-19`#[deny(unsafe_op_in_unsafe_fn)]` in liballocLeSeulArtichaut-25/+55
2020-05-29Add Extend::{extend_one,extend_reserve}Josh Stone-0/+20
This adds new optional methods on `Extend`: `extend_one` add a single element to the collection, and `extend_reserve` pre-allocates space for the predicted number of incoming elements. These are used in `Iterator` for `partition` and `unzip` as they shuffle elements one-at-a-time into their respective collections.
2020-05-12Remove `RawVec::double`.Nicholas Nethercote-6/+14
It's only used once, for `VecDeque`, and can easily be replaced by something else. The commit changes `grow_if_necessary` to `grow` to avoid some small regressions caused by changed inlining. The commit also removes `Strategy::Double`, and streamlines the remaining variants of `Strategy`. It's a compile time win on some benchmarks because the many instantations of `RawVec::grow` are a little smaller.
2020-04-23Fix doc link errorsTyler Ruckinger-1/+1
2020-04-22More diagnostic items for Clippy usagePhilipp Hansch-0/+1
This adds a couple of more diagnostic items to be used in Clippy. I chose these particular ones because they were the types which we seem to check for the most in Clippy. I'm not sure if the `cfg_attr(not(test))` is needed, but it was also used for `Vec` and a few other types.
2020-04-17Rollup merge of #71167 - RalfJung:big-o, r=shepmasterDylan DPC-3/+3
big-O notation: parenthesis for function calls, explicit multiplication I saw `O(n m log n)` in the docs and found that really hard to parse. In particular, I don't think we should use blank space as syntax for *both* multiplication and function calls, that is just confusing. This PR makes both multiplication and function calls explicit using Rust-like syntax. If you prefer, I can also leave one of them implicit, but I believe explicit is better here. While I was at it I also added backticks consistently.
2020-04-16Minor fixes to doc comments of 'VecDequeue'Youngsuk Kim-6/+6
1. Changed descriptions of `fn get` & `fn get_mut`. Since both of these functions are returning references, and not the owned value, I thought the doc comments could be fixed to be consistent with doc comments of `fn front` & `fn front_mut`. 2. Other changes are minor fixes or additions for clarification. Thank you for taking a look :)
2020-04-15big-O notation: parenthesis, multiplication and backticksRalf Jung-3/+3
2020-04-08add `VecDeque::make_contiguous` tracking issueBastian Kauschke-1/+1
2020-04-04use ManuallyDrop instead of forget inside collectionsTrevor Spiteri-6/+5
This commit changes some usage of mem::forget into mem::ManuallyDrop in some Vec, VecDeque, BTreeMap and Box methods. Before the commit, the generated IR for some of the methods was longer, and even after optimization, some unwinding artifacts were still present.
2020-03-31Rollup merge of #69425 - lcnr:make_contiguous, r=AmanieuDylan DPC-52/+153
add fn make_contiguous to VecDeque Adds the following method to VecDeque: ```rust pub fn make_contiguous(&mut self) -> &mut [T]; ``` Taken from https://github.com/rust-lang/rust/pull/69400, after a suggestion by @CryZe https://github.com/rust-lang/rust/pull/69400#issuecomment-590216089 I am in favor of merging this instead of https://github.com/rust-lang/rust/pull/69400.
2020-03-31fix docsBastian Kauschke-1/+1
2020-03-31update `VecDeque::as_(mut)_slice` docsBastian Kauschke-4/+4
2020-03-24must_use on split_offKornel-0/+1
#70194
2020-03-22update `make_contiguous` docsBastian Kauschke-1/+3
Co-Authored-By: Amanieu d'Antras <amanieu@gmail.com>
2020-03-22document invariant of `VecDeque::as_(mut)_slice`Bastian Kauschke-0/+6
2020-03-22add `fn make_contiguous` to VecDequeBastian Kauschke-52/+145
2020-03-06fix various typosMatthias Krüger-1/+1
2020-01-19Move VecDeque Drain iterator to new fileJonas Schievink-121/+5
2020-01-19Fix leak in VecDeque::drain when drop panicsJonas Schievink-34/+48
2020-01-19Fix `VecDeque::truncate` leak on drop panicJonas Schievink-1/+16
2019-12-26Remove redundant link textsMatthew Kraai-1/+1
2019-12-22Format the worldMark Rousskov-142/+108
2019-12-13Rollup merge of #67235 - jonas-schievink:vecdeque-leak, r=KodrAusMazdak Farrokhzad-1/+13
VecDeque: drop remaining items on destructor panic Closes https://github.com/rust-lang/rust/issues/67232
2019-12-12Add comment to `Dropper`Jonas Schievink-0/+2
2019-12-11VecDeque: drop remaining items on destructor panicJonas Schievink-1/+11
2019-11-13Match VecDeque::extend to Vec::extendCharles Gleason-1/+16
2019-10-29Use truncate(0) in VecDeque clearCharles Gleason-1/+1
2019-10-29Use ptr::drop_in_place in VecDeque truncateCharles Gleason-2/+25
2019-10-29Match docs for VecDeque truncate to Vec truncateCharles Gleason-1/+2
2019-10-22Apply clippy::needless_return suggestionsMateusz Mikuła-1/+1
2019-10-10Override nth for VecDeque Iter and IterMutCharles Gleason-0/+20
2019-10-10Implement Clone::clone_from for VecDequeCharles Gleason-2/+79
2019-08-22Fix formatting.Tomasz Różański-1/+1
2019-08-22Fix a typo.Tomasz Różański-1/+1
2019-08-18Auto merge of #63045 - Rosto75:master, r=jonas-schievinkbors-43/+43
Change the placement of two functions. Right now, the order is as follows: `pop_front()` `push_front()` `push_back()` `pop_back()` `swap_remove_back()` `swap_remove_front()` I believe it would be more natural, and easier to follow, if we place `pop_back()` right after the `pop_front()`, and `swap_remove_back()` after the `swap_remove_front()` like this: `pop_front()` `pop_back()` `push_front()` `push_back()` `swap_remove_front()` `swap_remove_back()` The rest of the documentation (at least in this module) adheres to the same logic, where the 'front' function always precedes its 'back' equivalent.
2019-08-16Rename CollectionAllocError to TryReserveErrorSimon Sapin-8/+8
2019-08-02liballoc: Unconfigure tests during normal buildVadim Petrochenkov-386/+3
Remove additional libcore-like restrictions from liballoc, turns out the testing works ok if the tests are a part of liballoc itself.
2019-07-28Use const generics for some VecDeque impls.Mazdak Farrokhzad-26/+14
2019-07-27Change the placement of two functions.Tomasz Różański-43/+43
Right now, the order is as follows: `pop_front()` `push_front()` `push_back()` `pop_back()` `swap_remove_back()` `swap_remove_front()` I believe it would be more natural, and easier to follow, if we place `pop_back()` right after the `pop_front()`, and `swap_remove_back()` after the `swap_remove_front()` like this: `pop_front()` `pop_back()` `push_front()` `push_back()` `swap_remove_front()` `swap_remove_back()` The rest of the documentation (at least in this module) adheres to the same logic, where the 'front' function always precedes its 'back' equivalent.
2019-07-25Auto merge of #60340 - mgeier:cap-vs-capacity, r=alexcrichtonbors-17/+17
Rename .cap() methods to .capacity() As mentioned in #60316, there are a few `.cap()` methods, which seem out-of-place because such methods are called `.capacity()` in the rest of the code. This PR renames them to `.capacity()` but leaves `RawVec::cap()` in there for backwards compatibility. I didn't try to mark the old version as "deprecated", because I guess this would cause too much noise.
2019-07-18Rollup merge of #61926 - scottmcm:vec-vecdeque, r=Mark-SimulacrumMark Rousskov-0/+6
Fix hyperlinks in From impls between Vec and VecDeque I'd been trying to link them, but apparently actually just added brackets: <https://doc.rust-lang.org/nightly/std/collections/struct.VecDeque.html#impl-From%3CVec%3CT%3E%3E> ~~This reverts commit 5168f5d220d0b30d322f254f51142931a9054056.~~ ~~(I'd previously tried to make relative links, but those failed linkcheck because the types are exported at different levels. So just skip the links -- they're already linked in the function signature anyway.)~~ This makes the links now work.