News for hackers. Stuff that matters.
Re:Getting Started with Tokio by thinkpad20 on Saturday December 24, 2016 @10:02PM (#13252653)
> use the nightly-only "-> impl Trait"

Can someone point me to more info on this? Possibly akin to existential types in Haskell?

Re:Getting Started with Tokio by Rusky on Sunday December 25, 2016 @12:05AM (#13253019)
It's not really existential types in the general sense. A function returning `impl SomeTrait` can still only return values of a single type, it's just that the compiler infers that type from the function body and then restricts the caller to accessing that value via the methods in `SomeTrait`.
Re:Getting Started with Tokio by thinkpad20 on Sunday December 25, 2016 @06:20PM (#13255960)
Yeah that's what I was thinking; e.g. in Haskell you can use existential types to refer to "some type which implements this type class", and then an object of that type will have the functions in that type class available to it and no others (more or less). Cool that rust has this as well, I'm excited to learn about it.
Re:Getting Started with Tokio by Rusky on Sunday December 25, 2016 @09:42PM (#13256634)
Rust has something else more general that's much closer to existentials- you can use trait objects to erase a value's type and restrict methods on it to those in the trait.

The difference between trait objects and `impl Trait` is that trait objects can hold any value that implements a trait, since they're implemented via dynamic dispatch.

Re:Getting Started with Tokio by steveklabnik on Sunday December 25, 2016 @12:33PM (#13254775)