Skip to content

Commit d301dff

Browse files
committed
Document how BTreeSet iterator structures are created.
1 parent cf9ad0a commit d301dff

File tree

1 file changed

+38
-0
lines changed
  • src/libcollections/btree

1 file changed

+38
-0
lines changed

src/libcollections/btree/set.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,44 +75,82 @@ pub struct BTreeSet<T> {
7575
}
7676

7777
/// An iterator over a `BTreeSet`'s items.
78+
///
79+
/// This structure is created by the [`iter()`] method on [`BTreeSet`].
80+
///
81+
/// [`BTreeSet`]: struct.BTreeSet.html
82+
/// [`iter()`]: struct.BTreeSet.html#method.iter
7883
#[stable(feature = "rust1", since = "1.0.0")]
7984
pub struct Iter<'a, T: 'a> {
8085
iter: Keys<'a, T, ()>,
8186
}
8287

8388
/// An owning iterator over a `BTreeSet`'s items.
89+
///
90+
/// This structure is created by the [`into_iter()`] method on [`BTreeSet`]
91+
/// [`BTreeSet`] (provided by the [`IntoIterator`] trait).
92+
///
93+
/// [`BTreeSet`]: struct.BTreeSet.html
94+
/// [`IntoIterator`]: ../../iter/trait.IntoIterator.html
95+
/// [`into_iter()`]: ../../iter/trait.IntoIterator.html#tymethod.into_iter
8496
#[stable(feature = "rust1", since = "1.0.0")]
8597
pub struct IntoIter<T> {
8698
iter: ::btree_map::IntoIter<T, ()>,
8799
}
88100

89101
/// An iterator over a sub-range of `BTreeSet`'s items.
102+
///
103+
/// This structure is created by the [`range()`] method on [`BTreeSet`].
104+
///
105+
/// [`BTreeSet`]: struct.BTreeSet.html
106+
/// [`range()`]: struct.BTreeSet.html#method.range
90107
pub struct Range<'a, T: 'a> {
91108
iter: ::btree_map::Range<'a, T, ()>,
92109
}
93110

94111
/// A lazy iterator producing elements in the set difference (in-order).
112+
///
113+
/// This structure is created by the [`difference()`] method on [`BTreeSet`].
114+
///
115+
/// [`BTreeSet`]: struct.BTreeSet.html
116+
/// [`difference()`]: struct.BTreeSet.html#method.difference
95117
#[stable(feature = "rust1", since = "1.0.0")]
96118
pub struct Difference<'a, T: 'a> {
97119
a: Peekable<Iter<'a, T>>,
98120
b: Peekable<Iter<'a, T>>,
99121
}
100122

101123
/// A lazy iterator producing elements in the set symmetric difference (in-order).
124+
///
125+
/// This structure is created by the [`symmetric_difference()`] method on
126+
/// [`BTreeSet`].
127+
///
128+
/// [`BTreeSet`]: struct.BTreeSet.html
129+
/// [`symmetric_difference()`]: struct.BTreeSet.html#method.symmetric_difference
102130
#[stable(feature = "rust1", since = "1.0.0")]
103131
pub struct SymmetricDifference<'a, T: 'a> {
104132
a: Peekable<Iter<'a, T>>,
105133
b: Peekable<Iter<'a, T>>,
106134
}
107135

108136
/// A lazy iterator producing elements in the set intersection (in-order).
137+
///
138+
/// This structure is created by the [`intersection()`] method on [`BTreeSet`].
139+
///
140+
/// [`BTreeSet`]: struct.BTreeSet.html
141+
/// [`intersection()`]: struct.BTreeSet.html#method.intersection
109142
#[stable(feature = "rust1", since = "1.0.0")]
110143
pub struct Intersection<'a, T: 'a> {
111144
a: Peekable<Iter<'a, T>>,
112145
b: Peekable<Iter<'a, T>>,
113146
}
114147

115148
/// A lazy iterator producing elements in the set union (in-order).
149+
///
150+
/// This structure is created by the [`union()`] method on [`BTreeSet`].
151+
///
152+
/// [`BTreeSet`]: struct.BTreeSet.html
153+
/// [`union()`]: struct.BTreeSet.html#method.union
116154
#[stable(feature = "rust1", since = "1.0.0")]
117155
pub struct Union<'a, T: 'a> {
118156
a: Peekable<Iter<'a, T>>,

0 commit comments

Comments
 (0)