rustcc / coroutine-rs

Coroutine Library in Rust
Apache License 2.0
414 stars 43 forks source link

Run without blocking like thread::spawn #75

Closed nihiluis closed 7 years ago

nihiluis commented 7 years ago

Is it possible to just execute the closure without blocking the thread waiting for it (like thread::spawn)?

cutting this essentially

    for num in coro {
        println!("{}", num.unwrap());
    }
zonyitoo commented 7 years ago

Well, what you want is a coroutine scheduler. Check this out.

nihiluis commented 7 years ago

coroutines are kinda sad in rust.

zonyitoo commented 7 years ago

Yes. It is said. But C# style yield is going to be merged in nightly. So .. well, at least we have stackless coroutines