Skip to content

Commit 1941ab9

Browse files
committed
update doc
1 parent d2a73a3 commit 1941ab9

File tree

1 file changed

+1
-35
lines changed

1 file changed

+1
-35
lines changed

corelib/src/iter/traits/iterator.cairo

+1-35
Original file line numberDiff line numberDiff line change
@@ -116,50 +116,16 @@ pub trait Iterator<T> {
116116
/// let a1 = array![1, 2, 3];
117117
/// let a2 = array![4, 5, 6];
118118
///
119-
/// let mut iter = a1.into_iter().zip(a2.into_iter());
119+
/// let mut iter = array![1, 2, 3].into_iter().zip(array![4, 5, 6].into_iter());
120120
///
121121
/// assert_eq!(iter.next(), Option::Some((1, 4)));
122122
/// assert_eq!(iter.next(), Option::Some((2, 5)));
123123
/// assert_eq!(iter.next(), Option::Some((3, 6)));
124124
/// assert_eq!(iter.next(), Option::None);
125125
/// ```
126126
///
127-
/// Since the argument to `zip()` uses [`IntoIterator`], we can pass
128-
/// anything that can be converted into an [`Iterator`], not just an
129-
/// [`Iterator`] itself. For example:
130-
///
131-
/// ```
132-
/// let a1 = array![1, 2, 3];
133-
/// let a2 = array![4, 5, 6];
134-
///
135-
/// let mut iter = a1.into_iter().zip(a2);
136-
///
137-
/// assert_eq!(iter.next(), Option::Some((1, 4)));
138-
/// assert_eq!(iter.next(), Option::Some((2, 5)));
139-
/// assert_eq!(iter.next(), Option::Some((3, 6)));
140-
/// assert_eq!(iter.next(), Option::None);
141-
/// ```
142-
///
143-
/// If both iterators have roughly equivalent syntax, it may be more readable to use [`zip`]:
144-
///
145-
/// ```
146-
/// use core::iter::zip;
147-
///
148-
/// let a = array![1, 2, 3];
149-
/// let b = array![2, 3, 4];
150-
///
151-
/// let mut zipped = zip(a, b);
152-
///
153-
/// assert_eq!(iter.next(), Option::Some((1, 4)));
154-
/// assert_eq!(iter.next(), Option::Some((2, 5)));
155-
/// assert_eq!(iter.next(), Option::Some((3, 6)));
156-
/// assert_eq!(iter.next(), Option::None);
157-
/// );
158-
/// ```
159-
///
160127
/// [`enumerate`]: Iterator::enumerate
161128
/// [`next`]: Iterator::next
162-
/// [`zip`]: core::iter::zip
163129
#[inline]
164130
fn zip<U, +Iterator<U> //, +IntoIterator<U>
165131
>(

0 commit comments

Comments
 (0)