Skip to content

Commit 8e28604

Browse files
committed
auto merge of #16887 : steveklabnik/rust/guide_iterators, r=alexcrichton
This isn't ready to merge yet. The 'containers and iterators' guide is basically just a collection of stuff that should be in the module definitions. So I'm moving the guide to just an 'iterators' guide, and moved the info that was there into the right places. So, is this a good path forward, and is all of the information still correct?
2 parents e73156f + 1b81802 commit 8e28604

File tree

8 files changed

+29
-428
lines changed

8 files changed

+29
-428
lines changed

src/doc/guide-container.md

+3-411
Large diffs are not rendered by default.

src/doc/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ a guide that can help you out:
5757
* [Strings](guide-strings.html)
5858
* [Pointers](guide-pointers.html)
5959
* [References and Lifetimes](guide-lifetimes.html)
60-
* [Containers and Iterators](guide-container.html)
6160
* [Tasks and Communication](guide-tasks.html)
6261
* [Foreign Function Interface](guide-ffi.html)
6362
* [Writing Unsafe and Low-Level Code](guide-unsafe.html)

src/libcollections/priority_queue.rs

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
//! A priority queue implemented with a binary heap.
1212
//!
13+
//! Insertions have `O(log n)` time complexity and checking or popping the largest element is
14+
//! `O(1)`. Converting a vector to a priority queue can be done in-place, and has `O(n)`
15+
//! complexity. A priority queue can also be converted to a sorted vector in-place, allowing it to
16+
//! be used for an `O(n log n)` in-place heapsort.
17+
//!
1318
//! # Example
1419
//!
1520
//! This is a larger example which implements [Dijkstra's algorithm][dijkstra]

src/libcollections/ringbuf.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! A double-ended queue implemented as a circular buffer.
12-
//!
13-
//! `RingBuf` implements the trait `Deque`. It should be imported with
14-
//! `use collections::Deque`.
11+
//! This crate implements a double-ended queue with `O(1)` amortized inserts and removals from both
12+
//! ends of the container. It also has `O(1)` indexing like a vector. The contained elements are
13+
//! not required to be copyable, and the queue will be sendable if the contained type is sendable.
14+
//! Its interface `Deque` is defined in `collections`.
1515
1616
use core::prelude::*;
1717

src/libcollections/treemap.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! An ordered map and set implemented as self-balancing binary search
12-
//! trees. The only requirement for the types is that the key implements
13-
//! `Ord`.
11+
//! Maps are collections of unique keys with corresponding values, and sets are
12+
//! just unique keys without a corresponding value. The `Map` and `Set` traits in
13+
//! `std::container` define the basic interface.
14+
//!
15+
//! This crate defines the `TreeMap` and `TreeSet` types. Their keys must implement `Ord`.
16+
//!
17+
//! `TreeMap`s are ordered.
1418
//!
1519
//! ## Example
1620
//!

src/libcollections/trie.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Ordered containers with unsigned integer keys,
12-
//! implemented as radix tries (`TrieSet` and `TrieMap` types).
11+
//! Maps are collections of unique keys with corresponding values, and sets are
12+
//! just unique keys without a corresponding value. The `Map` and `Set` traits in
13+
//! `std::container` define the basic interface.
14+
//!
15+
//! This crate defines `TrieMap` and `TrieSet`, which require `uint` keys.
16+
//!
17+
//! `TrieMap` is ordered.
1318
1419
use core::prelude::*;
1520

src/libcollections/vec.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! An owned, growable vector.
11+
//! A growable list type, written `Vec<T>` but pronounced 'vector.'
12+
//!
13+
//! Vectors have `O(1)` indexing, push (to the end) and pop (from the end).
1214
1315
use core::prelude::*;
1416

src/libcore/iter.rs

-6
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ loop {
5656
5757
This `for` loop syntax can be applied to any iterator over any type.
5858
59-
## Iteration protocol and more
60-
61-
More detailed information about iterators can be found in the [container
62-
guide](http://doc.rust-lang.org/guide-container.html) with
63-
the rest of the rust manuals.
64-
6559
*/
6660

6761
use clone::Clone;

0 commit comments

Comments
 (0)