| 1 | /// Combine all an iterator's elements into one element by using [`Extend`]. |
| 2 | /// |
| 3 | /// [`IntoIterator`]-enabled version of [`Itertools::concat`](crate::Itertools::concat). |
| 4 | /// |
| 5 | /// This combinator will extend the first item with each of the rest of the |
| 6 | /// items of the iterator. If the iterator is empty, the default value of |
| 7 | /// `I::Item` is returned. |
| 8 | /// |
| 9 | /// ```rust |
| 10 | /// use itertools::concat; |
| 11 | /// |
| 12 | /// let input = vec![vec![1], vec![2, 3], vec![4, 5, 6]]; |
| 13 | /// assert_eq!(concat(input), vec![1, 2, 3, 4, 5, 6]); |
| 14 | /// ``` |
| 15 | pub fn concatrust-analyzer cargo itertools 0.14.0 concat_impl/concat().<I>(iterable: I) -> I::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# |
| 16 | where |
| 17 | I: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#, |
| 18 | I::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item#: Extendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/Extend#<<<I as IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#>::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# as IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#>::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item#> + IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#, |
| 19 | { |
| 20 | iterable |
| 21 | .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().() |
| 22 | .reducerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#reduce().(|mut a, b| { |
| 23 | a.extendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/Extend#extend().(b); |
| 24 | a |
| 25 | }) |
| 26 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().() |
| 27 | } |