Skip to content

Commit ae36934

Browse files
committed
Document how BTreeSet iterator structures are created.
1 parent cf56c1f commit ae36934

File tree

1 file changed

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

1 file changed

+36
-0
lines changed

src/libcollections/btree/set.rs

+36
Original file line numberDiff line numberDiff line change
@@ -75,44 +75,80 @@ 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
8494
#[stable(feature = "rust1", since = "1.0.0")]
8595
pub struct IntoIter<T> {
8696
iter: ::btree_map::IntoIter<T, ()>,
8797
}
8898

8999
/// An iterator over a sub-range of `BTreeSet`'s items.
100+
///
101+
/// This structure is created by the [`range`] method on [`BTreeSet`].
102+
///
103+
/// [`BTreeSet`]: struct.BTreeSet.html
104+
/// [`range`]: struct.BTreeSet.html#method.range
90105
pub struct Range<'a, T: 'a> {
91106
iter: ::btree_map::Range<'a, T, ()>,
92107
}
93108

94109
/// A lazy iterator producing elements in the set difference (in-order).
110+
///
111+
/// This structure is created by the [`difference`] method on [`BTreeSet`].
112+
///
113+
/// [`BTreeSet`]: struct.BTreeSet.html
114+
/// [`difference`]: struct.BTreeSet.html#method.difference
95115
#[stable(feature = "rust1", since = "1.0.0")]
96116
pub struct Difference<'a, T: 'a> {
97117
a: Peekable<Iter<'a, T>>,
98118
b: Peekable<Iter<'a, T>>,
99119
}
100120

101121
/// A lazy iterator producing elements in the set symmetric difference (in-order).
122+
///
123+
/// This structure is created by the [`symmetric_difference`] method on
124+
/// [`BTreeSet`].
125+
///
126+
/// [`BTreeSet`]: struct.BTreeSet.html
127+
/// [`symmetric_difference`]: struct.BTreeSet.html#method.symmetric_difference
102128
#[stable(feature = "rust1", since = "1.0.0")]
103129
pub struct SymmetricDifference<'a, T: 'a> {
104130
a: Peekable<Iter<'a, T>>,
105131
b: Peekable<Iter<'a, T>>,
106132
}
107133

108134
/// A lazy iterator producing elements in the set intersection (in-order).
135+
///
136+
/// This structure is created by the [`intersection`] method on [`BTreeSet`].
137+
///
138+
/// [`BTreeSet`]: struct.BTreeSet.html
139+
/// [`intersection`]: struct.BTreeSet.html#method.intersection
109140
#[stable(feature = "rust1", since = "1.0.0")]
110141
pub struct Intersection<'a, T: 'a> {
111142
a: Peekable<Iter<'a, T>>,
112143
b: Peekable<Iter<'a, T>>,
113144
}
114145

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

0 commit comments

Comments
 (0)