Hacker News new | past | comments | ask | show | jobs | submit login

I think the concept is that you are awaiting the "request type". And getting back a "response type". The example is somewhat confusing since set_debug() returns a StorageRequest.

With tooling this would make your resulting type be a StorageResponse. The whole point is that you can have that "request type" be awaitable.




Apparently, there's another meaning to word "simpler", of which I'm unaware :D


You may be thinking of "primitive", "simplistic" or "spartan". Things that are simple to use are not necessarily primitive.

It's simpler for library users, because they don't need to know which particular method finalizes a builder to obtain a future from it, and `.await` just works in more situations.


That's not quite the best example as someone else noted, you could better of write an API where converting to Future can be a shore of in places where await may work in the Future.

Say, `for await x in connection.item {}` not real syntax but something similar might be in Rust's future.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: