Not sure if I missed this in the post, does this depend on any unstabilized features or can we use this today on 1.10.0 stable? Awesome stuff btw, love the iterator inspiration.
Zero-cost futures in Rust
11–20 of 348 posts
Re: Zero-cost futures in Rust
#12Finally a nice async/io interface for rust, always felt that it was a big missing piece, couple of questions for peps familiar with async in other languages : 1 - Isn't the state machine approach the same as C#/.net async/await is using ? But the with the added convenience of the syntactic sugar ? 2 - no allocation : , does'nt the lambda closure need to be allocated somewhere ? 3 - I would have love some comparison (…
The one time that you do tend to see closures get boxed is when returning them, because you can't write out their type. In the future you'll be able to get around that by using the `impl Trait` syntax mentioned in the post (https://github.com/rust-lang/rfcs/pull/1522).
Re: Zero-cost futures in Rust
#13Not sure if I missed this in the post, does this depend on any unstabilized features or can we use this today on 1.10.0 stable? Awesome stuff btw, love the iterator inspiration.
I think "impl Trait" is unstable.
So, this will work on stable. It was presented that way to not get into the whole details about the whole impl trait shenanigans in general.
Re: Zero-cost futures in Rust
#14Not sure if I missed this in the post, does this depend on any unstabilized features or can we use this today on 1.10.0 stable? Awesome stuff btw, love the iterator inspiration.
I think "impl Trait" is unstable.
Re: Zero-cost futures in Rust
#15Re: Zero-cost futures in Rust
#16Is there any special handling for Futures that complete with an error? Also, how do you debug code that's hung or taking too long? It might be useful to get a list of all the jobs (incomplete Futures) that are currently running, much like running 'ps'.
Re: Zero-cost futures in Rust
#17Earlier quoted context omitted.
I think "impl Trait" is unstable.
It is, however, it's not currently actually using that syntax in the code: http://alexcrichton.com/futures-rs/futures/trait.Future.html So, this will work on stable. It was presented that way to not get into the whole details about the whole impl trait shenanigans in general.
Re: Zero-cost futures in Rust
#18Finally a nice async/io interface for rust, always felt that it was a big missing piece, couple of questions for peps familiar with async in other languages : 1 - Isn't the state machine approach the same as C#/.net async/await is using ? But the with the added convenience of the syntactic sugar ? 2 - no allocation : , does'nt the lambda closure need to be allocated somewhere ? 3 - I would have love some comparison (…
> Isn't the state machine approach the same as C#/.net async/await is using ? But the with the added convenience of the syntactic sugar ? Similar in principle, but the implementation is different. Tasks in C# are more of an OO style instead of a FP style where they turn into an enum (sum type, if you want to get theoretical). > 2 - no allocation : , does'nt the lambda closure need to be allocated somewhere ? No, not…
Re: Zero-cost futures in Rust
#19Not sure if I missed this in the post, does this depend on any unstabilized features or can we use this today on 1.10.0 stable? Awesome stuff btw, love the iterator inspiration.
I'd recommend a beta compiler for now though to compile some of the examples. There's a bug in the stable compiler which causes them to take up to 8x longer to compile, but beta/nightly are both speedy!
Re: Zero-cost futures in Rust
#20Is there any special handling for Futures that complete with an error? Also, how do you debug code that's hung or taking too long? It might be useful to get a list of all the jobs (incomplete Futures) that are currently running, much like running 'ps'.
In terms of debugging, there's not infrastructure currently, but the kind of thing you're talking about should be easy to add!