Skip to content

Commit

Permalink
Improved chain docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelMon committed Aug 25, 2022
1 parent 7a27408 commit 860f239
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/free.rs
Expand Up @@ -128,17 +128,23 @@ pub fn zip<I, J>(i: I, j: J) -> Zip<I::IntoIter, J::IntoIter>
i.into_iter().zip(j)
}

/// Create an iterator that first iterates `i` and then `j`.

/// Takes two iterators and creates a new iterator over both in sequence.
///
/// [`IntoIterator`] enabled version of [`Iterator::chain`].
///
/// ## Example
/// ```
/// use itertools::chain;
///
/// let mut result:Vec<i32> = Vec::new();
///
/// for elt in chain(&[1, 2, 3], &[4]) {
/// /* loop body */
/// for element in chain(&[1, 2, 3] , &[4]) {
/// result.push(*element);
/// }
/// assert_eq!(result, vec![1, 2, 3, 4]);
/// ```
#[deprecated(note="Use std::iter::Chain instead", since="1.0.0")]
pub fn chain<I, J>(i: I, j: J) -> iter::Chain<<I as IntoIterator>::IntoIter, <J as IntoIterator>::IntoIter>
where I: IntoIterator,
J: IntoIterator<Item = I::Item>
Expand Down

0 comments on commit 860f239

Please sign in to comment.