Created
August 13, 2024 16:51
-
-
Save MolotovCherry/2ced737cd08dd421470d4d67aea20b65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(gen_blocks)] | |
fn foo() -> impl Iterator<Item = i32> { | |
gen { | |
yield 123; | |
for i in 0..10 { | |
yield i * i; | |
} | |
yield 321; | |
} | |
} | |
fn main() { | |
for i in foo() { | |
dbg!(i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment