Debian Codegraph @

debian/missing-sources/itertools/src/zip_eq_impl.rs

raw symbols SCIP
1 use superrust-analyzer cargo itertools 0.14.0 crate/::size_hintrust-analyzer cargo itertools 0.14.0 size_hint/;
2
3 /// An iterator which iterates two other iterators simultaneously
4 /// and panic if they have different lengths.
5 ///
6 /// See [`.zip_eq()`](crate::Itertools::zip_eq) for more information.
7 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
8 #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
9 pub struct ZipEqrust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#<I, J> {
10 arust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#a.: I,
11 brust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#b.: J,
12 }
13
14 /// Zips two iterators but **panics** if they are not of the same length.
15 ///
16 /// [`IntoIterator`] enabled version of [`Itertools::zip_eq`](crate::Itertools::zip_eq).
17 ///
18 /// ```
19 /// use itertools::zip_eq;
20 ///
21 /// let data = [1, 2, 3, 4, 5];
22 /// for (a, b) in zip_eq(&data[..data.len() - 1], &data[1..]) {
23 /// /* loop body */
24 /// # let _ = (a, b);
25 /// }
26 /// ```
27 pub fn zip_eqrust-analyzer cargo itertools 0.14.0 zip_eq_impl/zip_eq().<I, J>(i: I, j: J) -> ZipEqrust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#<I::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter#, J::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter#>
28 where
29 I: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#,
30 J: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#,
31 {
32 ZipEqrust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq# {
33 arust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#a.: i.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().(),
34 brust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#b.: j.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().(),
35 }
36 }
37
38 impl<I, J> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for ZipEqrust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#<I, J>
39 where
40 I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#,
41 J: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#,
42 {
43 type Itemrust-analyzer cargo itertools 0.14.0 zip_eq_impl/impl#[`ZipEq<I, J>`][Iterator]Item# = (I::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#, J::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#);
44
45 fn nextrust-analyzer cargo itertools 0.14.0 zip_eq_impl/impl#[`ZipEq<I, J>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo itertools 0.14.0 zip_eq_impl/impl#[`ZipEq<I, J>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
46 match (self.arust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#a..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().(), self.brust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#b..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().()) {
47 (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
48 (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(a), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b)) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((a, b)),
49 (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(_)) | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(_), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => {
50 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("itertools: .zip_eq() reached end of one iterator before the other")
51 }
52 }
53 }
54
55 fn size_hintrust-analyzer cargo itertools 0.14.0 zip_eq_impl/impl#[`ZipEq<I, J>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) {
56 size_hintrust-analyzer cargo itertools 0.14.0 size_hint/::minrust-analyzer cargo itertools 0.14.0 size_hint/min().(self.arust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#a..size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#size_hint().(), self.brust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#b..size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#size_hint().())
57 }
58 }
59
60 impl<I, J> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for ZipEqrust-analyzer cargo itertools 0.14.0 zip_eq_impl/ZipEq#<I, J>
61 where
62 I: ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator#,
63 J: ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator#,
64 {
65 }