Skip to content

Commit

Permalink
Merge #632
Browse files Browse the repository at this point in the history
632: Added body to free::zip's doc example r=phimuemue a=JoelMon

Added body to the code example in the docs for free::zip. The code body added uses two types to make it obvious how `zip` functions.

Co-authored-by: Joel Montes de Oca <6587811+JoelMon@users.noreply.github.com>
  • Loading branch information
bors[bot] and JoelMon committed Jul 10, 2022
2 parents 6b7063a + 9150cab commit 7a27408
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/free.rs
Expand Up @@ -112,10 +112,14 @@ pub fn rev<I>(iterable: I) -> iter::Rev<I::IntoIter>
/// ```
/// use itertools::zip;
///
/// let data = [1, 2, 3, 4, 5];
/// for (a, b) in zip(&data, &data[1..]) {
/// /* loop body */
/// let data_1 = [1, 2, 3, 4, 5];
/// let data_2 = ['a', 'b', 'c'];
/// let mut result: Vec<(i32, char)> = Vec::new();
///
/// for (a, b) in zip(&data_1, &data_2) {
/// result.push((*a, *b));
/// }
/// assert_eq!(result, vec![(1, 'a'),(2, 'b'),(3, 'c')]);
/// ```
pub fn zip<I, J>(i: I, j: J) -> Zip<I::IntoIter, J::IntoIter>
where I: IntoIterator,
Expand Down

0 comments on commit 7a27408

Please sign in to comment.