mirror of https://github.com/rust-lang/rfcs.git
Add simpler method to proposed example
This commit is contained in:
parent
7afbf18ede
commit
bde6dd9b26
|
@ -91,6 +91,13 @@ fn make_iter(limit: u8) -> impl Iterator<Item = u8> {
|
|||
(0..limit).map(move |x| (x..limit)).flatten()
|
||||
}
|
||||
|
||||
// Even better
|
||||
fn make_iter(limit: u8) -> impl Iterator<Item = u8> {
|
||||
#[cfg(not(accessible(::std::iter::Flatten)))]
|
||||
use itertools::Itertools;
|
||||
(0..limit).map(move |x| (x..limit)).flatten()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("{:?}", make_iter(10).collect::<Vec<_>>());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue